From a7a1c3c2cc8bf163a3cbd2c877ec8d4579838f52 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 14 Jan 2025 14:17:55 -0800 Subject: [PATCH] Add test. --- tests/cuda/optix-hit-attributes.slang | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/cuda/optix-hit-attributes.slang diff --git a/tests/cuda/optix-hit-attributes.slang b/tests/cuda/optix-hit-attributes.slang new file mode 100644 index 0000000000..3474018930 --- /dev/null +++ b/tests/cuda/optix-hit-attributes.slang @@ -0,0 +1,15 @@ +//TEST:SIMPLE(filecheck=CHECK): -target cuda +//CHECK: __global__ void __closesthit__closestHitShaderA +struct RayPayload +{ + float4 color; +}; + +[shader("closesthit")] +void closestHitShaderA(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr) +{ + uint primitiveIndex = PrimitiveIndex(); + float4 color = float4(0, 0, 0, 1); + color[primitiveIndex] = 1; + payload.color = color; +}