struct VertexOutput {
  @builtin(position) clip_pos: vec4<f32>,
  @location(0) texture_coords: vec2<f32>,
}

@vertex
fn vs_main(
    @builtin(vertex_index) in_vertex_index: u32,
) -> VertexOutput {
    var out: VertexOutput;
    var vertex_pos = vec2<f32>(
        f32(in_vertex_index & 1),
        f32(in_vertex_index >> 1),
    );

    out.clip_pos = vec4<f32>(vertex_pos * 2 - 1, 0.0, 1.0);
    out.texture_coords = vec2<f32>(vertex_pos.x, 1 - vertex_pos.y);
    return out;
}

@group(0) @binding(0)
var t_diffuse: texture_2d<f32>;
@group(1) @binding(0)
var s_diffuse: sampler;

@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
    return textureSample(t_diffuse, s_diffuse, in.texture_coords);
}
