From 5c111ebef679c994047df95bbdf90181ccb2d067 Mon Sep 17 00:00:00 2001 From: jarcherNV Date: Wed, 2 Apr 2025 01:46:52 -0700 Subject: Use correct syntax for WGSL array transpiling (#6693) Fixes issue #6533 This patch updates handling of Array and ConstantBuffer types for WGSL transpiling, giving correct syntax for arrays of buffers in WGSL. --- tests/wgsl/buffer-array.slang | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/wgsl/buffer-array.slang (limited to 'tests/wgsl/buffer-array.slang') diff --git a/tests/wgsl/buffer-array.slang b/tests/wgsl/buffer-array.slang new file mode 100644 index 000000000..3ab27eaac --- /dev/null +++ b/tests/wgsl/buffer-array.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=WGSL): -stage vertex -entry main -target wgsl + +static const int cubeCount = 3; + +struct PerInstanceUniforms +{ + float4x4 model; + float4x4 normalModel; +}; + +// WGSL: @binding(0) @group(0) var perInstance_0 : array; +[[vk::binding(0, 0)]] ConstantBuffer perInstance[cubeCount] : register(b0, space0); + +struct VertexInput +{ + float4 position : POSITION0; +}; + +float4 main(VertexInput input) +{ + // Only here to ensure that perInstance is not ignored. + float4 pos = mul(input.position, perInstance[0].model); + return pos; +} -- cgit v1.2.3