diff options
author | Michael Jones <michael_p_jones@apple.com> | 2021-12-14 01:20:16 +0300 |
---|---|---|
committer | Michael Jones <michael_p_jones@apple.com> | 2021-12-14 01:34:48 +0300 |
commit | e688c927eb3a82b21ba744ec57540ea2cd4f44c8 (patch) | |
tree | 294f18f8adf2d7a668d67399939b22239743e551 /intern/cycles/device/multi/device.cpp | |
parent | b8952ecec947308ded826d6025ddfe7d6ff0325e (diff) |
Fix T94022: Both options GPU/CPU checked under preferences cause viewport render crash. (ARM/Metal)
This fixes crash T94022 when selecting live viewport render with both GPU & CPU devices selected. It is caused by incorrect `KernelBVHLayout` assignment. Similar to `BVH_LAYOUT_MULTI_OPTIX` for Optix, this patch adds a `BVH_LAYOUT_MULTI_METAL` to correctly redirect to the correct Metal BVH layout type.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D13561
Diffstat (limited to 'intern/cycles/device/multi/device.cpp')
-rw-r--r-- | intern/cycles/device/multi/device.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/device/multi/device.cpp b/intern/cycles/device/multi/device.cpp index baab84f4035..5ec3ef1b785 100644 --- a/intern/cycles/device/multi/device.cpp +++ b/intern/cycles/device/multi/device.cpp @@ -124,6 +124,11 @@ class MultiDevice : public Device { return BVH_LAYOUT_MULTI_OPTIX; } + /* With multiple Metal devices, every device needs its own acceleration structure */ + if (bvh_layout_mask == BVH_LAYOUT_METAL) { + return BVH_LAYOUT_MULTI_METAL; + } + /* When devices do not share a common BVH layout, fall back to creating one for each */ const BVHLayoutMask BVH_LAYOUT_OPTIX_EMBREE = (BVH_LAYOUT_OPTIX | BVH_LAYOUT_EMBREE); if ((bvh_layout_mask_all & BVH_LAYOUT_OPTIX_EMBREE) == BVH_LAYOUT_OPTIX_EMBREE) { @@ -155,6 +160,7 @@ class MultiDevice : public Device { } assert(bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX || + bvh->params.bvh_layout == BVH_LAYOUT_MULTI_METAL || bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE || bvh->params.bvh_layout == BVH_LAYOUT_MULTI_METAL_EMBREE); @@ -179,6 +185,8 @@ class MultiDevice : public Device { BVHParams params = bvh->params; if (bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX) params.bvh_layout = BVH_LAYOUT_OPTIX; + else if (bvh->params.bvh_layout == BVH_LAYOUT_MULTI_METAL) + params.bvh_layout = BVH_LAYOUT_METAL; else if (bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE) params.bvh_layout = sub.device->info.type == DEVICE_OPTIX ? BVH_LAYOUT_OPTIX : BVH_LAYOUT_EMBREE; |