From 3373d14b1b05b2ee5dc88efff5dc8b1a5fe20f36 Mon Sep 17 00:00:00 2001 From: Patrick Mours Date: Tue, 5 Jan 2021 18:37:31 +0100 Subject: 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 --- intern/cycles/device/device_multi.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'intern') 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(bvh); bvh_multi->sub_bvhs.resize(devices.size()); -- cgit v1.2.3