.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "rtcJoinCommitScene" "3" "" "" "Embree Ray Tracing Kernels 4"
.hy
.SS NAME
.IP
.nf
\f[C]
rtcJoinCommitScene - commits the scene from multiple threads
\f[R]
.fi
.SS SYNOPSIS
.IP
.nf
\f[C]
#include <embree4/rtcore.h>

void rtcJoinCommitScene(RTCScene scene);
\f[R]
.fi
.SS DESCRIPTION
.PP
The \f[C]rtcJoinCommitScene\f[R] function commits all changes for the
specified scene (\f[C]scene\f[R] argument).
The scene commit internally triggers building of a spatial acceleration
structure for the scene.
Ray queries can be performed after scene changes got properly committed.
.PP
The \f[C]rtcJoinCommitScene\f[R] function can get called from multiple
user threads which will all cooperate in the build operation.
All threads calling into this function will return from
\f[C]rtcJoinCommitScene\f[R] after the scene commit is finished.
All threads must consistently call \f[C]rtcJoinCommitScene\f[R] and not
\f[C]rtcCommitScene\f[R].
.PP
In contrast to the \f[C]rtcCommitScene\f[R] function, the
\f[C]rtcJoinCommitScene\f[R] function can be called from multiple user
threads, while the \f[C]rtcCommitScene\f[R] can only get called from
multiple TBB worker threads when used concurrently.
For optimal performance we strongly recommend using TBB inside the
application together with the \f[C]rtcCommitScene\f[R] function and to
avoid using the \f[C]rtcJoinCommitScene\f[R] function.
.PP
The \f[C]rtcJoinCommitScene\f[R] feature allows a flexible way to lazily
create hierarchies during rendering.
A thread reaching a not-yet-constructed sub-scene of a two-level scene
can generate the sub-scene geometry and call
\f[C]rtcJoinCommitScene\f[R] on that just generated scene.
During construction, further threads reaching the not-yet-built scene
can join the build operation by also invoking
\f[C]rtcJoinCommitScene\f[R].
A thread that calls \f[C]rtcJoinCommitScene\f[R] after the build
finishes will directly return from the \f[C]rtcJoinCommitScene\f[R]
call.
.PP
Multiple scene commit operations on different scenes can be running at
the same time, hence it is possible to commit many small scenes in
parallel, distributing the commits to many threads.
.PP
When using Embree with the Intel\[rg] Threading Building Blocks (which
is the default), threads that call \f[C]rtcJoinCommitScene\f[R] will
join the build operation, but other TBB worker threads might also
participate in the build.
To avoid thread oversubscription, we recommend using TBB also inside the
application.
Further, the join mode only works properly starting with TBB v4.4 Update
1.
For earlier TBB versions, threads that call \f[C]rtcJoinCommitScene\f[R]
to join a running build will just trigger the build and wait for the
build to finish.
Further, old TBB versions with \f[C]TBB_INTERFACE_VERSION_MAJOR < 8\f[R]
do not support \f[C]rtcJoinCommitScene\f[R], and invoking this function
will result in an error.
.PP
When using Embree with the internal tasking system, only threads that
call \f[C]rtcJoinCommitScene\f[R] will perform the build operation, and
no additional worker threads will be scheduled.
.PP
When using Embree with the Parallel Patterns Library (PPL),
\f[C]rtcJoinCommitScene\f[R] is not supported and calling that function
will result in an error.
.PP
To detect whether \f[C]rtcJoinCommitScene\f[R] is supported, use the
\f[C]rtcGetDeviceProperty\f[R] function.
.SS EXIT STATUS
.PP
On failure an error code is set that can be queried using
\f[C]rtcGetDeviceError\f[R].
.SS SEE ALSO
.PP
[rtcCommitScene], [rtcGetDeviceProperty]
