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/kernel/geom | |
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/kernel/geom')
-rw-r--r-- | intern/cycles/kernel/geom/motion_triangle_intersect.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/triangle_intersect.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/kernel/geom/motion_triangle_intersect.h b/intern/cycles/kernel/geom/motion_triangle_intersect.h index 72ad237eeeb..3bbb7be685d 100644 --- a/intern/cycles/kernel/geom/motion_triangle_intersect.h +++ b/intern/cycles/kernel/geom/motion_triangle_intersect.h @@ -101,8 +101,8 @@ ccl_device_inline const int isect_prim, float3 verts[3]) { -# ifdef __KERNEL_OPTIX__ - /* t is always in world space with OptiX. */ +# if defined(__KERNEL_GPU_RAYTRACING__) + /* t is always in world space with OptiX and MetalRT. */ return motion_triangle_refine(kg, sd, P, D, t, isect_object, isect_prim, verts); # else # ifdef __INTERSECTION_REFINE__ diff --git a/intern/cycles/kernel/geom/triangle_intersect.h b/intern/cycles/kernel/geom/triangle_intersect.h index 57a6ae7fe72..4a7f38131da 100644 --- a/intern/cycles/kernel/geom/triangle_intersect.h +++ b/intern/cycles/kernel/geom/triangle_intersect.h @@ -227,8 +227,8 @@ ccl_device_inline float3 triangle_refine_local(KernelGlobals kg, const int isect_object, const int isect_prim) { -#ifdef __KERNEL_OPTIX__ - /* t is always in world space with OptiX. */ +#if defined(__KERNEL_GPU_RAYTRACING__) + /* t is always in world space with OptiX and MetalRT. */ return triangle_refine(kg, sd, P, D, t, isect_object, isect_prim); #else if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { |