summaryrefslogtreecommitdiff
path: root/tests/compute
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/atomics-buffer.slang4
-rw-r--r--tests/compute/atomics-invalid-dest-type.slang24
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/compute/atomics-buffer.slang b/tests/compute/atomics-buffer.slang
index 72b86368d..6745d6b58 100644
--- a/tests/compute/atomics-buffer.slang
+++ b/tests/compute/atomics-buffer.slang
@@ -9,7 +9,11 @@
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cuda -shaderobj
// Atomics not available on CPU currently
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -cpu -shaderobj
+// RWBuffer does not work with the GFX backend as expected with Metal
//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
+//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain
+
+//METALLIB: @computeMain
//TEST_INPUT:ubuffer(format=R_UInt32, data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]):out,name outputBuffer
diff --git a/tests/compute/atomics-invalid-dest-type.slang b/tests/compute/atomics-invalid-dest-type.slang
new file mode 100644
index 000000000..864debaee
--- /dev/null
+++ b/tests/compute/atomics-invalid-dest-type.slang
@@ -0,0 +1,24 @@
+// atomics-buffer.slang
+
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain
+//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain
+//TEST:SIMPLE(filecheck=CHECK): -target glsl -stage compute -entry computeMain
+//TEST:SIMPLE(filecheck=CHECK): -target metal -stage compute -entry computeMain
+
+//CHECK: Atomic must be applied to a scalar texture or non-texture
+
+RWBuffer<uint2> outputBuffer;
+
+void test(uint val)
+{
+ uint originalValue;
+
+ InterlockedAdd(outputBuffer[val][0], val, originalValue);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ test(tid);
+}