summaryrefslogtreecommitdiff
path: root/tests/testdata/webgpu/hellotriangle_shader.wgsl
blob: 9359c11adf0767c477790cd1a256714b22501b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// only test purpose
override value: f32;

@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
    // only test purpose
    _ = value;

    let x = f32(i32(in_vertex_index) - 1);
    let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
    return vec4<f32>(x, y, 0.0, 1.0);
}

@fragment
fn fs_main() -> @location(0) vec4<f32> {
    // only test purpose
    _ = value;

    return vec4<f32>(1.0, 0.0, 0.0, 1.0);
}