dawn-cmake/test/bug/tint/824.wgsl.expected.wgsl
Sarah b6fdcc54df transform: remove VarForDynamicIndex transform.
Dynamic indexes are limited to references to matrices and arrays
https://github.com/gpuweb/gpuweb/pull/1801

Bug: tint:867
Change-Id: I114daa053c8a4ffd23ce784ac4538567a551cc21
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
2021-06-16 17:42:53 +00:00

18 lines
793 B
WebGPU Shading Language

struct Output {
[[builtin(position)]]
Position : vec4<f32>;
[[location(0)]]
color : vec4<f32>;
};
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32, [[builtin(instance_index)]] InstanceIndex : u32) -> Output {
var zv : array<vec2<f32>, 4> = array<vec2<f32>, 4>(vec2<f32>(0.200000003, 0.200000003), vec2<f32>(0.300000012, 0.300000012), vec2<f32>(-0.100000001, -0.100000001), vec2<f32>(1.100000024, 1.100000024));
let z : f32 = zv[InstanceIndex].x;
var output : Output;
output.Position = vec4<f32>(0.5, 0.5, z, 1.0);
var colors : array<vec4<f32>, 4> = array<vec4<f32>, 4>(vec4<f32>(1.0, 0.0, 0.0, 1.0), vec4<f32>(0.0, 1.0, 0.0, 1.0), vec4<f32>(0.0, 0.0, 1.0, 1.0), vec4<f32>(1.0, 1.0, 1.0, 1.0));
output.color = colors[InstanceIndex];
return output;
}