From 0b4e463aee4107b383067424007c6a995f1f9f87 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 11 Feb 2025 19:07:57 +0800 Subject: Add raypayload decoration to ray payload structs (#6164) * Add raypayload decoration to ray payload structs Closes https://github.com/shader-slang/slang/issues/6104 * Disable PAQs when compiling with DXC See https://github.com/shader-slang/slang/issues/3448 --- tests/hlsl/raypayload-attribute-no-struct.slang | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/hlsl/raypayload-attribute-no-struct.slang (limited to 'tests/hlsl/raypayload-attribute-no-struct.slang') diff --git a/tests/hlsl/raypayload-attribute-no-struct.slang b/tests/hlsl/raypayload-attribute-no-struct.slang new file mode 100644 index 000000000..c7ad94593 --- /dev/null +++ b/tests/hlsl/raypayload-attribute-no-struct.slang @@ -0,0 +1,29 @@ +//enable when https://github.com/shader-slang/slang/issues/3448 is implemented +//DISABLE_TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage raygeneration -entry rayGenShaderA + +// CHECK: struct [raypayload] + +uniform RWTexture2D resultTexture; +uniform RaytracingAccelerationStructure sceneBVH; + +[shader("raygeneration")] +void rayGenShaderA() +{ + int2 threadIdx = DispatchRaysIndex().xy; + + float3 rayDir = float3(0, 0, 1); + float3 rayOrigin = 0; + rayOrigin.x = (threadIdx.x * 2) - 1; + rayOrigin.y = (threadIdx.y * 2) - 1; + + // Trace the ray. + RayDesc ray; + ray.Origin = rayOrigin; + ray.Direction = rayDir; + ray.TMin = 0.001; + ray.TMax = 10000.0; + float4 payload = float4(0, 0, 0, 0); + TraceRay(sceneBVH, RAY_FLAG_NONE, ~0, 0, 0, 0, ray, payload); + + resultTexture[threadIdx.xy] = payload; +} -- cgit v1.2.3