Files
wgpu/tests/gpu-tests/scissor_tests/solid_white.wgsl
T

34 lines
840 B
WebGPU Shading Language

// meant to be called with 3 vertex indices: 0, 1, 2
// draws one large triangle over the clip space like this:
// (the asterisks represent the clip space bounds)
//-1,1 1,1
// ---------------------------------
// | * .
// | * .
// | * .
// | * .
// | * .
// | * .
// |***************
// | . 1,-1
// | .
// | .
// | .
// | .
// |.
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> {
let x = i32(vertex_index) / 2;
let y = i32(vertex_index) & 1;
return vec4<f32>(
f32(x) * 4.0 - 1.0,
1.0 - f32(y) * 4.0,
0.0, 1.0
);
}
@fragment
fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(1.0);
}