From 4533c825fe628e08228037b846ee9d10004fd56f Mon Sep 17 00:00:00 2001 From: cheneym2 Date: Wed, 1 May 2024 19:16:38 -0400 Subject: SPIRV: Fix storage class for unwrapped pointers (#4068) In SPIRV legalization, a struct wrapper is created around push constants but is not itself legalized. Putting the struct type into the work list causes the storage access of the push constant pointer to be PhysicalStorageBuffer as expected, instead of Function scope that was produced without the added struct legalization. Adds a SPIRV test that exercises the fix. Fixes #3946 Co-authored-by: Yong He --- tests/spirv/pointer-bug-3.slang | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/spirv/pointer-bug-3.slang (limited to 'tests') diff --git a/tests/spirv/pointer-bug-3.slang b/tests/spirv/pointer-bug-3.slang new file mode 100644 index 000000000..60fa70a6e --- /dev/null +++ b/tests/spirv/pointer-bug-3.slang @@ -0,0 +1,10 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -O0 + +[[vk::push_constant]] float4 *positions; +[shader("vertex")] +float4 main() +{ + return positions[0]; +} +// NOT %cbuffer__t = OpTypeStruct %_ptr_Function_v4float +// CHECK: %cbuffer__t = OpTypeStruct %_ptr_PhysicalStorageBuffer_v4float -- cgit v1.2.3