diff options
author | Patrick Mours <pmours@nvidia.com> | 2021-01-05 20:37:31 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2021-01-05 20:37:31 +0300 |
commit | 3373d14b1b05b2ee5dc88efff5dc8b1a5fe20f36 (patch) | |
tree | baf72f17fc45afa6cf3b89fa1c5b3e36ed50f596 /intern/cycles | |
parent | 491a9e9ec496185887caae319a5e11c48e5c12a5 (diff) |
Fix T83925: Crash when rendering on the CPU with OptiX denoiser enabled
Rendering on the CPU uses the Embree BVH layout, whether the OptiX denoiser is enabled or not.
This means the "build_bvh" function gets a "BVHEmbree" object to fill and not a "BVHMulti" as it
was assuming before, which caused crashes due to memory geting overwritten incorrectly. This
fixes that by redirecting Embree BVH builds to the Embree device.
Manifest Tasks: T83925
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/device/device_multi.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index e5b138917ff..44959577fb5 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -248,11 +248,14 @@ class MultiDevice : public Device { void build_bvh(BVH *bvh, Progress &progress, bool refit) override { /* Try to build and share a single acceleration structure, if possible */ - if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2) { + if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2 || bvh->params.bvh_layout == BVH_LAYOUT_EMBREE) { devices.back().device->build_bvh(bvh, progress, refit); return; } + assert(bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX || + bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE); + BVHMulti *const bvh_multi = static_cast<BVHMulti *>(bvh); bvh_multi->sub_bvhs.resize(devices.size()); |