summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjarcherNV <jarcher@nvidia.com>2025-04-02 01:46:52 -0700
committerGitHub <noreply@github.com>2025-04-02 08:46:52 +0000
commit5c111ebef679c994047df95bbdf90181ccb2d067 (patch)
tree60ab2f331973768f6be7f9ff9ff3ac8720f13be5 /tests
parent3ebfe7f7c91a9ca356a6940b8878f1fc926be6aa (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/wgsl/buffer-array.slang24
1 files changed, 24 insertions, 0 deletions
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<uniform> perInstance_0 : array<PerInstanceUniforms_std140_0, i32(3)>;
+[[vk::binding(0, 0)]] ConstantBuffer<PerInstanceUniforms> 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;
+}