summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/byte-address-buffer.slang40
-rw-r--r--tests/compute/byte-address-buffer.slang.expected.txt4
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/compute/byte-address-buffer.slang b/tests/compute/byte-address-buffer.slang
new file mode 100644
index 000000000..2efbeb630
--- /dev/null
+++ b/tests/compute/byte-address-buffer.slang
@@ -0,0 +1,40 @@
+// byte-address-buffer.slang
+
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-d3d12 -compute
+
+// Confirm cross-compilation of `(RW)ByteAddressBuffer`
+//
+// TODO: I'm only using `RWByteAddressBuffer` for now because I don't
+// know if `render-test` supports the non-UAV case.
+
+//TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]):dxbinding(0),glbinding(0)
+RWByteAddressBuffer inputBuffer;
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0]):dxbinding(1),glbinding(1),out
+RWByteAddressBuffer outputBuffer;
+
+void test(int val)
+{
+ uint tmp = val;
+
+ tmp = inputBuffer.Load(tmp * 4);
+
+ uint2 pair = inputBuffer.Load2(tmp * 4);
+ tmp = (pair.x + pair.y) & 0xF;
+
+ uint4 quad = inputBuffer.Load4(tmp * 4);
+ tmp = (quad.x + quad.y + quad.z + quad.w) & 0xF;
+
+ outputBuffer.Store(val * 4, tmp);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ int val = int(tid);
+ test(val);
+} \ No newline at end of file
diff --git a/tests/compute/byte-address-buffer.slang.expected.txt b/tests/compute/byte-address-buffer.slang.expected.txt
new file mode 100644
index 000000000..ba948e8bb
--- /dev/null
+++ b/tests/compute/byte-address-buffer.slang.expected.txt
@@ -0,0 +1,4 @@
+A
+2
+A
+2