diff options
Diffstat (limited to 'reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag')
-rw-r--r-- | reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag b/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag index 3ab6a471..b584f04d 100644 --- a/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag +++ b/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag @@ -9,6 +9,30 @@ using namespace metal::raytracing; using namespace metal; +intersection_params spvMakeIntersectionParams(uint flags) +{ + intersection_params ip; + if ((flags & 1) != 0) + ip.force_opacity(forced_opacity::opaque); + if ((flags & 2) != 0) + ip.force_opacity(forced_opacity::non_opaque); + if ((flags & 4) != 0) + ip.accept_any_intersection(true); + if ((flags & 16) != 0) + ip.set_triangle_cull_mode(triangle_cull_mode::back); + if ((flags & 32) != 0) + ip.set_triangle_cull_mode(triangle_cull_mode::front); + if ((flags & 64) != 0) + ip.set_opacity_cull_mode(opacity_cull_mode::opaque); + if ((flags & 128) != 0) + ip.set_opacity_cull_mode(opacity_cull_mode::non_opaque); + if ((flags & 256) != 0) + ip.set_geometry_cull_mode(geometry_cull_mode::triangle); + if ((flags & 512) != 0) + ip.set_geometry_cull_mode(geometry_cull_mode::bounding_box); + return ip; +} + struct main0_out { float4 outColor [[color(0)]]; @@ -22,7 +46,7 @@ struct main0_in static inline __attribute__((always_inline)) uint doRay(thread const float3& rayOrigin, thread const float3& rayDirection, thread const float& rayDistance, thread raytracing::intersection_query<raytracing::instancing, raytracing::triangle_data>& rayQuery, thread const raytracing::acceleration_structure<raytracing::instancing>& topLevelAS) { - rayQuery.reset(ray(rayOrigin, rayDirection, 0.001000000047497451305389404296875, rayDistance), topLevelAS, intersection_params()); + rayQuery.reset(ray(rayOrigin, rayDirection, 0.001000000047497451305389404296875, rayDistance), topLevelAS, spvMakeIntersectionParams(4u)); for (;;) { bool _36 = rayQuery.next(); |