summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/atomics-buffer.slang28
-rw-r--r--tests/compute/atomics-buffer.slang.expected.txt4
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/compute/atomics-buffer.slang b/tests/compute/atomics-buffer.slang
new file mode 100644
index 000000000..92f00272d
--- /dev/null
+++ b/tests/compute/atomics-buffer.slang
@@ -0,0 +1,28 @@
+// atomics-buffer.slang
+
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+
+// Note: not enabling D3D12 test yet because change
+// was developed on a machine that can run D3D12
+//
+//TEST_DISABLED(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12
+
+//TEST_INPUT:ubuffer(format=R_UInt32, data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):dxbinding(0),glbinding(0),out
+
+RWBuffer<uint> outputBuffer;
+
+void test(uint val)
+{
+ uint originalValue;
+
+ InterlockedAdd(outputBuffer[val], val, originalValue);
+ InterlockedAdd(outputBuffer[val ^ 1], val*16, originalValue);
+ InterlockedAdd(outputBuffer[val ^ 2], val*16*16, originalValue);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ test(tid);
+} \ No newline at end of file
diff --git a/tests/compute/atomics-buffer.slang.expected.txt b/tests/compute/atomics-buffer.slang.expected.txt
new file mode 100644
index 000000000..36caeb8d6
--- /dev/null
+++ b/tests/compute/atomics-buffer.slang.expected.txt
@@ -0,0 +1,4 @@
+210
+301
+32
+123