dawn-cmake/test/bug/tint/824.wgsl
Ben Clayton 01e4b6fc18 wgsl: Replace [[decoration]] with @decoration
Deprecate the old syntax. Migrate everything to the new syntax.

Bug: tint:1382
Change-Id: Ide12b2e927b17dc93b9714c7049090864cc568d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
2022-01-19 22:46:57 +00:00

26 lines
872 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 {
// TODO: remove workaround for Tint unary array access broke
let zv : array<vec2<f32>, 4> = array<vec2<f32>, 4>(
vec2<f32>(0.2, 0.2),
vec2<f32>(0.3, 0.3),
vec2<f32>(-0.1, -0.1),
vec2<f32>(1.1, 1.1));
let z : f32 = zv[InstanceIndex].x;
var output : Output;
output.Position = vec4<f32>(0.5, 0.5, z, 1.0);
let 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;
}