summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-ir-use-uninitialized-values.cpp2
-rw-r--r--tests/bugs/gh-5022.slang22
2 files changed, 23 insertions, 1 deletions
diff --git a/source/slang/slang-ir-use-uninitialized-values.cpp b/source/slang/slang-ir-use-uninitialized-values.cpp
index c09077528..98fd9841a 100644
--- a/source/slang/slang-ir-use-uninitialized-values.cpp
+++ b/source/slang/slang-ir-use-uninitialized-values.cpp
@@ -265,7 +265,7 @@ namespace Slang
// Consider it as a store if its passed
// as an out/inout/ref parameter
- IRType* type = ftype->getParamType(index);
+ auto type = unwrapAttributedType(ftype->getParamType(index));
return (as<IROutType>(type) || as<IRInOutType>(type) || as<IRRefType>(type)) ? Store : Load;
}
diff --git a/tests/bugs/gh-5022.slang b/tests/bugs/gh-5022.slang
new file mode 100644
index 000000000..6d1b71991
--- /dev/null
+++ b/tests/bugs/gh-5022.slang
@@ -0,0 +1,22 @@
+//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu
+
+// CHECK: 0
+// CHECK-NEXT: 1
+// CHECK-NEXT: 2
+// CHECK-NEXT: 3
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+groupshared int myInt;
+
+void set(__ref groupshared int i){ i = 1; }
+int use(__ref groupshared int i){ return i; }
+
+[numthreads(4, 1, 1)]
+void computeMain(uint i : SV_GroupIndex)
+{
+ set(myInt);
+ use(myInt);
+ outputBuffer[i] = i;
+}