mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-15 17:45:58 +00:00
Spec change: https://github.com/gpuweb/gpuweb/pull/2427 Reverses: tint:867 This reverts and fixes commits: b6fdcc54df6e012578e69550788e2b4b2b611c32 10442eff7db4271d53eed553795e655068488276 Added a bunch of end-to-end tests. Fixed: tint:1352 Change-Id: I34968243bbec1cab838c8ba50a6f027146bbfd06 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75401 Reviewed-by: David Neto <dneto@google.com> Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
26 lines
887 B
WebGPU Shading Language
26 lines
887 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;
|
|
}
|