summaryrefslogtreecommitdiffstats
path: root/tests/metal
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-02-20 18:59:49 -0600
committerGitHub <noreply@github.com>2025-02-20 16:59:49 -0800
commit4d286aab2ec23c081f23846f5dfdb30b1c05728b (patch)
tree98be13f2d72d90d69901d463a94c292d562cee67 /tests/metal
parent19867ffca6dca7995c799354081219c9e76f13d1 (diff)
Metal fix (#6413)
Partially fix #6378 * Fix invalid access mode for texture_buffer * Fix texture view create issue in metal In newTextureView, levelRange should represent the mipmap level range, while sliceRange should represent the texture layer range for texture array. But the implement inverse those two wrongly.
Diffstat (limited to 'tests/metal')
-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);
+}