Skip to content

Commit

Permalink
Scene embree: Make sure we also sync threads when destroying accel ha…
Browse files Browse the repository at this point in the history
…ndle

In the scenario where we record a ray-trace operation, destroy the scene and then evaluate, we also need sync in callback when IAS is freed
We still need sync in ~Scene because once a ray-trace
  • Loading branch information
rtabbara committed Dec 14, 2023
1 parent 11d9902 commit 7bb672c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/render/scene_embree.inl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ MI_VARIANT void Scene<Float, Spectrum>::accel_parameters_changed_cpu() {
m_accel_handle.index(),
[](uint32_t /* index */, int free, void *payload) {
if (free) {
// Ensure all ray tracing kernels are terminated before
// releasing the scene
// This is needed in the scenario where we record a
// ray-tracing operation, the scene is destroyed, and we
// only trigger an evaluation afterwards
if constexpr (dr::is_llvm_v<Float>)
dr::sync_thread();

Log(Debug, "Free Embree scene state..");
EmbreeState<Float> *s = (EmbreeState<Float> *) payload;
rtcReleaseScene(s->accel);
Expand Down

0 comments on commit 7bb672c

Please sign in to comment.