From d36eea7fa7c1ec8a82e7bbaeea6c017d5e434022 Mon Sep 17 00:00:00 2001 From: Nikita Sirgienko Date: Sat, 27 Sep 2025 21:07:39 +0200 Subject: [PATCH] Fix #129596: Always use multithreaded BVH building in Cycles again The workaround of forcing BVH building into single thread execution on the Blender side is not needed anymore, because the problem was properly fixed in the upstream since Embree upgrade in Blender 4.5 This reverts commit c0f0e2ca6f3fc0aefab93542211e01bc61be8f34. Pull Request: https://projects.blender.org/blender/blender/pulls/146859 --- intern/cycles/device/device.cpp | 13 ------------- intern/cycles/device/device.h | 2 -- intern/cycles/scene/geometry.cpp | 16 +++------------- intern/cycles/scene/geometry.h | 1 - 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index a31a3834440..56afeb3126e 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -831,17 +831,4 @@ bool GPUDevice::is_shared(const void *shared_pointer, /* DeviceInfo */ -bool DeviceInfo::contains_device_type(const DeviceType type) const -{ - if (this->type == type) { - return true; - } - for (const DeviceInfo &info : multi_devices) { - if (info.contains_device_type(type)) { - return true; - } - } - return false; -} - CCL_NAMESPACE_END diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index c22e9c09da8..27c57a01d51 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -119,8 +119,6 @@ class DeviceInfo { { return !(*this == info); } - - bool contains_device_type(const DeviceType type) const; }; /* Device */ diff --git a/intern/cycles/scene/geometry.cpp b/intern/cycles/scene/geometry.cpp index ebb29be436e..6e79ccd8a01 100644 --- a/intern/cycles/scene/geometry.cpp +++ b/intern/cycles/scene/geometry.cpp @@ -957,12 +957,6 @@ void GeometryManager::device_update(Device *device, } }); - /* Work around Embree/oneAPI bug #129596 with BVH updates. */ - /* Also note the use of #bvh_task_pool_, see its definition for details. */ - const bool use_multithreaded_build = first_bvh_build || - !device->info.contains_device_type(DEVICE_ONEAPI); - first_bvh_build = false; - size_t i = 0; size_t num_bvh = 0; for (Geometry *geom : scene->geometry) { @@ -974,14 +968,10 @@ void GeometryManager::device_update(Device *device, num_bvh++; } - if (use_multithreaded_build) { - bvh_task_pool_.push([geom, device, dscene, scene, &progress, i, &num_bvh] { - geom->compute_bvh(device, dscene, &scene->params, &progress, i, num_bvh); - }); - } - else { + /* Note the use of #bvh_task_pool_, see its definition for details. */ + bvh_task_pool_.push([geom, device, dscene, scene, &progress, i, &num_bvh] { geom->compute_bvh(device, dscene, &scene->params, &progress, i, num_bvh); - } + }); } } diff --git a/intern/cycles/scene/geometry.h b/intern/cycles/scene/geometry.h index 0d6181d4616..d2687dbf6ae 100644 --- a/intern/cycles/scene/geometry.h +++ b/intern/cycles/scene/geometry.h @@ -237,7 +237,6 @@ class GeometryManager { /* Update Flags */ bool need_flags_update; - bool first_bvh_build = true; /* Constructor/Destructor */ GeometryManager();