summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/metal/test_buffer.slang17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/metal/test_buffer.slang b/tests/metal/test_buffer.slang
new file mode 100644
index 000000000..122af3b9a
--- /dev/null
+++ b/tests/metal/test_buffer.slang
@@ -0,0 +1,17 @@
+// Test that Buffer<T> maps to texture_buffer<uint, access::read> in Metal
+
+//TEST:SIMPLE(filecheck=METAL): -stage compute -entry computeMain -target metal
+
+
+// METAL: texture_buffer<uint, access::read> inputBuffer_{{.*}}
+Buffer<uint> inputBuffer;
+
+RWStructuredBuffer<uint> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dtid : SV_DispatchThreadID)
+{
+ uint idx = dtid.x;
+ // Load values from the buffer to verify correct access
+ outputBuffer[idx] = inputBuffer.Load(idx);
+}