diff options
author | Michael Jones <michael_p_jones@apple.com> | 2021-11-29 18:06:22 +0300 |
---|---|---|
committer | Michael Jones <michael_p_jones@apple.com> | 2021-11-29 18:20:26 +0300 |
commit | f613c4c0953ebaf993ecd55b12bab9cf2196dac4 (patch) | |
tree | 0cb08f0e144290913b483289220f13c366665504 /intern/cycles/bvh | |
parent | 98a5c924fca00b4b39e75a4fc16585cfa040398c (diff) |
Cycles: MetalRT support (kernel side)
This patch adds MetalRT support to Cycles kernel code. It is mostly additive in nature or confined to Metal-specific code, however there are a few areas where this interacts with other code:
- MetalRT closely follows the Optix implementation, and in some cases (notably handling of transforms) it makes sense to extend Optix special-casing to MetalRT. For these generalisations we now have `__KERNEL_GPU_RAYTRACING__` instead of `__KERNEL_OPTIX__`.
- MetalRT doesn't support primitive offsetting (as with `primitiveIndexOffset` in Optix), so we define and populate a new kernel texture, `__object_prim_offset`, containing per-object primitive / curve-segment offsets. This is referenced and applied in MetalRT intersection handlers.
- Two new BVH layout enum values have been added: `BVH_LAYOUT_METAL` and `BVH_LAYOUT_MULTI_METAL_EMBREE` for XPU mode). Some host-side enum case handling has been updated where it is trivial to do so.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D13353
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp index ae6655eb27b..d3c8e4db6d0 100644 --- a/intern/cycles/bvh/bvh.cpp +++ b/intern/cycles/bvh/bvh.cpp @@ -40,8 +40,11 @@ const char *bvh_layout_name(BVHLayout layout) return "EMBREE"; case BVH_LAYOUT_OPTIX: return "OPTIX"; + case BVH_LAYOUT_METAL: + return "METAL"; case BVH_LAYOUT_MULTI_OPTIX: case BVH_LAYOUT_MULTI_OPTIX_EMBREE: + case BVH_LAYOUT_MULTI_METAL_EMBREE: return "MULTI"; case BVH_LAYOUT_ALL: return "ALL"; @@ -105,7 +108,10 @@ BVH *BVH::create(const BVHParams ¶ms, #endif case BVH_LAYOUT_MULTI_OPTIX: case BVH_LAYOUT_MULTI_OPTIX_EMBREE: + case BVH_LAYOUT_MULTI_METAL_EMBREE: return new BVHMulti(params, geometry, objects); + case BVH_LAYOUT_METAL: + /* host-side changes for BVH_LAYOUT_METAL are imminent */ case BVH_LAYOUT_NONE: case BVH_LAYOUT_ALL: break; |