From 86221ff4757ee504307f3537b34acb05117ce272 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 6 Apr 2022 19:07:30 -0700 Subject: Fixed the mapping of the ray tracing instance functions to GLSL (#2177) * Fixed the mapping of the *InstanceID() and *InstanceIndex() functions to GLSL. * Fixed and somewhat improved the vkray/closesthit test. --- tests/vkray/closesthit.slang | 2 +- tests/vkray/closesthit.slang.glsl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/vkray/closesthit.slang b/tests/vkray/closesthit.slang index 28c759175..b1b73c94e 100644 --- a/tests/vkray/closesthit.slang +++ b/tests/vkray/closesthit.slang @@ -18,7 +18,7 @@ void main( BuiltInTriangleIntersectionAttributes attributes, in out ReflectionRay ioPayload) { - uint materialID = InstanceIndex() + uint materialID = (InstanceIndex() << 1) + InstanceID() + PrimitiveIndex() + HitKind() diff --git a/tests/vkray/closesthit.slang.glsl b/tests/vkray/closesthit.slang.glsl index e3af26a04..b5daef909 100644 --- a/tests/vkray/closesthit.slang.glsl +++ b/tests/vkray/closesthit.slang.glsl @@ -48,10 +48,12 @@ rayPayloadInNV ReflectionRay_0 tmp_payload; void main() { - uint tmp_customidx = gl_InstanceCustomIndexNV; uint tmp_instanceid = gl_InstanceID; + uint tmp_shift_0 = tmp_instanceid << 1; + + uint tmp_customidx = gl_InstanceCustomIndexNV; - uint tmp_add_0 = tmp_customidx + tmp_instanceid; + uint tmp_add_0 = tmp_shift_0 + tmp_customidx; uint tmp_primid = gl_PrimitiveID; uint tmp_add_1 = tmp_add_0 + tmp_primid; -- cgit v1.2.3