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 --- source/slang/slang-ir-spirv-legalize.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'source') diff --git a/source/slang/slang-ir-spirv-legalize.cpp b/source/slang/slang-ir-spirv-legalize.cpp index 2f392a178..311ff0e89 100644 --- a/source/slang/slang-ir-spirv-legalize.cpp +++ b/source/slang/slang-ir-spirv-legalize.cpp @@ -182,6 +182,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase IRBuilder builder(cbParamInst); builder.setInsertBefore(cbParamInst); auto structType = builder.createStructType(); + addToWorkList(structType); StringBuilder sb; sb << "cbuffer_"; getTypeNameHint(sb, innerType); -- cgit v1.2.3