yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jarcherNVUse correct syntax for WGSL array transpiling (#6693)5c111ebef

master
647 B24 linesraw
1//TEST:SIMPLE(filecheck=WGSL): -stage vertex -entry main -target wgsl
2
3static const int cubeCount = 3;
4
5struct PerInstanceUniforms
6{
7    float4x4 model;
8    float4x4 normalModel;
9};
10
11// WGSL: @binding(0) @group(0) var<uniform> perInstance_0 : array<PerInstanceUniforms_std140_0, i32(3)>;
12[[vk::binding(0, 0)]] ConstantBuffer<PerInstanceUniforms> perInstance[cubeCount] : register(b0, space0);
13
14struct VertexInput
15{
16    float4 position : POSITION0;
17};
18
19float4 main(VertexInput input)
20{
21    // Only here to ensure that perInstance is not ignored.
22    float4 pos = mul(input.position, perInstance[0].model);
23    return pos;
24}