summaryrefslogtreecommitdiff
path: root/tests/wgsl
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-05 19:33:55 -0800
committerGitHub <noreply@github.com>2024-12-06 03:33:55 +0000
commit7dabfa76ccfb396e9d2019e2b6e01259d1661dc5 (patch)
tree8f9a39b9d25d04051d02e63450f66c852d744e62 /tests/wgsl
parentecc5a39feecbf73feedf352214406c8752af798a (diff)
Implement explciit binding for metal and wgsl. (#5778)
* Respect explicit bindings in wgsl emit. * Implement explciit binding generation for metal and wgsl. * Update toc. * Fix warnings in tests. * Fix tests. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/wgsl')
-rw-r--r--tests/wgsl/explicit-binding.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/wgsl/explicit-binding.slang b/tests/wgsl/explicit-binding.slang
new file mode 100644
index 000000000..d2cf73a69
--- /dev/null
+++ b/tests/wgsl/explicit-binding.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE(filecheck=METAL): -target metal
+//TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute
+
+// CHECK-DAG: @binding(9) @group(7)
+// CHECK-DAG: @binding(3) @group(4)
+// CHECK-DAG: @binding(1) @group(2)
+
+// METAL-DAG: buffer(9)
+// METAL-DAG: texture(7)
+
+[vk::binding(1, 2)]
+Texture2D texA : register(t7);
+
+[vk::binding(3, 4)]
+ConstantBuffer<float> cb;
+
+RWStructuredBuffer<float> ob : register(u9, space7);
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ ob[0] = cb + texA.Load(int3(0)).x;
+} \ No newline at end of file