196.9. embree-4.4.1
Intel's CPU ray-tracing kernels for renderers, from SSE2 to AVX-512, chosen at run time
| Version | 4.4.1, release 1 |
| Shelf | 3d — 3D modelling, animation, voxel and mesh tools and libraries, and scientific visualisation |
| Phase | 42_graphics (Graphics Stack), 25 of 189 in build order |
| Licence | Apache-2.0 |
| Homepage | https://www.embree.org/ |
| Build time | 18.0 SBU |
| Installed size | 40.0 MiB in 183 files |
| Recipe | ports/core/3d/embree/kpkgbuild |
About
Embree is Intel’s library of ray-tracing kernels for the processor: the acceleration structures and the ray intersection tests a renderer builds on. In KDOS Blender builds its Cycles renderer with it (WITH_CYCLES_EMBREE). Kernels for every x86-64 instruction set from SSE2 to AVX-512 are compiled into the one library, and it chooses the widest the running processor has.
Sources
embree-4.4.1.tar.gz(67.3 MiB)
sha256dcf338cc61b636c871ccf370e673bfd380c5ecb71ce49ad50f28e1d4ec9995dc
upstream: https://github.com/RenderKit/embree/archive/refs/tags/v4.4.1.tar.gz
archive copy: sources-1/3d--embree-4.4.1.tar.gz
Dependencies
Depends on: cmake, ninja, ispc, onetbb.
Required by (1): blender.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install embree'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/3d/embree.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/3d/embree
echo 'dcf338cc61b636c871ccf370e673bfd380c5ecb71ce49ad50f28e1d4ec9995dc embree-4.4.1.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/embree
SRC=$SRC_ROOT/embree-4.4.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf embree-4.4.1.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cmake -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DEMBREE_STATIC_LIB=OFF \
-DEMBREE_ZIP_MODE=OFF \
-DEMBREE_INSTALL_DEPENDENCIES=OFF \
-DEMBREE_TUTORIALS=OFF \
-DEMBREE_TASKING_SYSTEM=TBB \
-DEMBREE_ISPC_SUPPORT=ON \
-DEMBREE_ISPC_EXECUTABLE=/usr/bin/ispc \
-DEMBREE_SYCL_SUPPORT=OFF \
-DEMBREE_ISA_SSE2=ON \
-DEMBREE_ISA_SSE42=ON \
-DEMBREE_ISA_AVX=ON \
-DEMBREE_ISA_AVX2=ON \
-DEMBREE_ISA_AVX512=ON \
-DEMBREE_STACK_PROTECTOR=ON \
-DEMBREE_RAY_MASK=ON \
-DEMBREE_BACKFACE_CULLING=OFF \
-DEMBREE_FILTER_FUNCTION=ON \
-DEMBREE_GEOMETRY_TRIANGLE=ON \
-DEMBREE_GEOMETRY_QUAD=ON \
-DEMBREE_GEOMETRY_CURVE=ON \
-DEMBREE_GEOMETRY_SUBDIVISION=ON \
-DEMBREE_GEOMETRY_USER=ON \
-DEMBREE_GEOMETRY_INSTANCE=ON \
-DEMBREE_GEOMETRY_INSTANCE_ARRAY=ON \
-DEMBREE_GEOMETRY_GRID=ON \
-DEMBREE_GEOMETRY_POINT=ON
cmake --build build
DESTDIR=$PKG cmake --install build
test -f "$PKG/usr/lib/libembree4.so"
The switches, and why each is set:
-DEMBREE_STATIC_LIB=OFF— Buildlibembree4.so, the shared library.build.shchecks that it was installed.-DEMBREE_ZIP_MODE=OFF— Install with the system layout, and name the library file with the full version,libembree4.so.4.4.1. Upstream’s default, on, lays the files out as its binary release archive:embree-vars.shandembree-vars.cshat the top of the prefix and an$ORIGIN/../libRPATH. The library carries an$ORIGINRPATH in either mode, which upstream sets so that it finds a oneTBB copied beside it; here oneTBB is in/usr/libwith it, so the entry changes nothing.-DEMBREE_INSTALL_DEPENDENCIES=OFF— Do not copy oneTBB’s libraries into the package; the onetbb port provides them.-DEMBREE_TUTORIALS=OFF— Leave out the tutorial programs, which upstream builds by default.-DEMBREE_TASKING_SYSTEM=TBB— Build hierarchies in parallel with oneTBB. It is upstream’s default.-DEMBREE_ISPC_SUPPORT=ON,-DEMBREE_ISPC_EXECUTABLE=/usr/bin/ispc— Install the headers and bindings for programs written in ISPC, Intel’s SPMD compiler, built with the ispc port. Off by default upstream.-DEMBREE_SYCL_SUPPORT=OFF— No SYCL kernels for Intel GPUs.-DEMBREE_ISA_SSE2=ON— This switch and the four after it,-DEMBREE_ISA_SSE42=ON,-DEMBREE_ISA_AVX=ON,-DEMBREE_ISA_AVX2=ONand-DEMBREE_ISA_AVX512=ON, compile a kernel set for each instruction set; the library picks one at run time. Upstream turns the AVX sets on only when the compiler passes a test for each, so naming them keeps the set the same on every build.-DEMBREE_STACK_PROTECTOR=ON— Compile with stack protection against overwritten return addresses. Off by default upstream.-DEMBREE_RAY_MASK=ON,-DEMBREE_FILTER_FUNCTION=ON— Ray masks, with which a ray skips the geometry whose mask it does not match, and intersection filter callbacks. Both are upstream’s defaults.-DEMBREE_BACKFACE_CULLING=OFF— The kernels report hits on both sides of a surface. It is upstream’s default.-DEMBREE_GEOMETRY_TRIANGLE=ON— This switch and the otherEMBREE_GEOMETRY_switches (quads, curves, subdivision surfaces, user geometry, instances, instance arrays, grids and points) build every geometry type. All are upstream’s defaults, named so the set cannot change.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/embree, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf embree-4.4.1-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/embree, and runs the triggers its paths call for.
Contents
Installed libraries: libembree4.so.
Installed directories: /usr/include/embree4, /usr/lib/cmake/embree-4.4.1, /usr/share/doc/embree4, /usr/share/licenses/embree.