summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-518.slang36
-rw-r--r--tests/bugs/gh-518.slang.expected.txt4
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/bugs/gh-518.slang b/tests/bugs/gh-518.slang
new file mode 100644
index 000000000..96a101db2
--- /dev/null
+++ b/tests/bugs/gh-518.slang
@@ -0,0 +1,36 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12
+//TEST_DISABLED(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
+
+// Note: can't actually test this on Vulkan right now because
+// the support in render-test isn't good enough.
+
+// Confirm that we can handle arrays of resources
+// being passed to a function.
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+RWStructuredBuffer<int> gBuffer;
+
+//TEST_INPUT: Texture2D(size=4, content=one):dxbinding(0),glbinding(0)
+//TEST_INPUT: Texture2D(size=4, content=one):dxbinding(1),glbinding(1)
+Texture2D gTextures[2];
+
+float broken(Texture2D t[2])
+{
+ return t[0].Load(int3(0)).x + t[1].Load(int3(0)).x;
+}
+
+int test(int val)
+{
+ return val*int(broken(gTextures));
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ int val = int(tid);
+ val = test(val);
+ gBuffer[tid] = val;
+} \ No newline at end of file
diff --git a/tests/bugs/gh-518.slang.expected.txt b/tests/bugs/gh-518.slang.expected.txt
new file mode 100644
index 000000000..e1e8ccec4
--- /dev/null
+++ b/tests/bugs/gh-518.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+2
+4
+6