summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-566.slang34
-rw-r--r--tests/bugs/gh-566.slang.expected.txt4
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/bugs/gh-566.slang b/tests/bugs/gh-566.slang
new file mode 100644
index 000000000..eeb8c1639
--- /dev/null
+++ b/tests/bugs/gh-566.slang
@@ -0,0 +1,34 @@
+// legalize-struct-init.slang
+
+//TEST(compute):COMPARE_COMPUTE:
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+//TEST_INPUT:ubuffer(data=[4 3 2 1], stride=4):dxbinding(1),glbinding(1)
+
+
+RWStructuredBuffer<uint> outputBuffer;
+RWStructuredBuffer<uint> inputBuffer;
+
+struct Helper
+{
+ RWStructuredBuffer<uint> o;
+ RWStructuredBuffer<uint> i;
+ uint t;
+};
+
+void test(Helper h)
+{
+ h.o[h.t] = h.i[h.t] * 16 + h.t;
+}
+
+void test(uint t)
+{
+ Helper h = { outputBuffer, inputBuffer, t };
+ test(h);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ test(tid);
+}
diff --git a/tests/bugs/gh-566.slang.expected.txt b/tests/bugs/gh-566.slang.expected.txt
new file mode 100644
index 000000000..309b89a9a
--- /dev/null
+++ b/tests/bugs/gh-566.slang.expected.txt
@@ -0,0 +1,4 @@
+40
+31
+22
+13