From 7dabfa76ccfb396e9d2019e2b6e01259d1661dc5 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 5 Dec 2024 19:33:55 -0800 Subject: 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 --- tests/wgsl/explicit-binding.slang | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/wgsl/explicit-binding.slang (limited to 'tests/wgsl') 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 cb; + +RWStructuredBuffer ob : register(u9, space7); + +[numthreads(1,1,1)] +void computeMain() +{ + ob[0] = cb + texA.Load(int3(0)).x; +} \ No newline at end of file -- cgit v1.2.3