From de7ccaf127d8bb847a0ad25f45e8d1902dc1b958 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 6 Aug 2025 15:56:27 -0700 Subject: Fix unused space discovery for bindless heap. (#8075) --- tests/spirv/descriptor-heap-space.slang | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/spirv/descriptor-heap-space.slang (limited to 'tests') diff --git a/tests/spirv/descriptor-heap-space.slang b/tests/spirv/descriptor-heap-space.slang new file mode 100644 index 000000000..8ab905b87 --- /dev/null +++ b/tests/spirv/descriptor-heap-space.slang @@ -0,0 +1,41 @@ +//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry main + +// Test that we can find the correct unused descriptor set index when there is `ParameterBlock` in the shader. + +//CHECK: layout(binding = 2, set = 2) +//CHECK-NEXT: uniform texture2D _slang_resource_heap + +struct VSInput{ + float3 position; +} + +struct VSOutput{ + float4 position : SV_Position; +} + +struct CameraData{ + float3 position; +} + +ParameterBlock cameraData; + + +struct Material{ + DescriptorHandle texture; + DescriptorHandle samplerState; +} + +StructuredBuffer materials; + +struct FSOutput{ + float4 outColor : SV_Target0; +} + + +[shader("fragment")] +FSOutput main(){ + FSOutput output; + output.outColor = materials[0].texture.Sample(materials[0].samplerState, float2(0)); + output.outColor.x *= cameraData.position.x; + return output; +} \ No newline at end of file -- cgit v1.2.3