summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/generic-groupshared.slang29
-rw-r--r--tests/bugs/generic-groupshared.slang.expected.txt4
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/bugs/generic-groupshared.slang b/tests/bugs/generic-groupshared.slang
new file mode 100644
index 000000000..c5ed8cf40
--- /dev/null
+++ b/tests/bugs/generic-groupshared.slang
@@ -0,0 +1,29 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[ForceInline]
+Ref<uint> table<let n: int>(int index)
+{
+ static groupshared uint array[n];
+ return array[index];
+}
+
+struct S<let n : int>
+{
+ static const int M = n * 2;
+ int doSomething()
+ {
+ table<M>(0) = M;
+ return table<M>(0);
+ }
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
+{
+ S<2> s;
+ outputBuffer[0] = s.doSomething();
+} \ No newline at end of file
diff --git a/tests/bugs/generic-groupshared.slang.expected.txt b/tests/bugs/generic-groupshared.slang.expected.txt
new file mode 100644
index 000000000..a358987a6
--- /dev/null
+++ b/tests/bugs/generic-groupshared.slang.expected.txt
@@ -0,0 +1,4 @@
+4
+0
+0
+0