1struct VertexOutput {2 @builtin(position) position: vec4<f32>,3 @location(0) tex_coords: vec2<f32>,4}6@vertex7fn vs_main(@builtin(vertex_index) vi: u32) -> VertexOutput {8 var out: VertexOutput;10 out.tex_coords = vec2<f32>(11 f32((vi << 1u) & 2u),12 f32(vi & 2u),13 );15 out.position = vec4<f32>(out.tex_coords * 2.0 - 1.0, 0.0, 1.0);17 // Invert y so the texture is not upside down18 out.tex_coords.y = 1.0 - out.tex_coords.y;19 return out;20}22@group(0) @binding(0)23var texture: texture_2d<f32>;24@group(0) @binding(1)25var texture_sampler: sampler;27@fragment28fn fs_main(vs: VertexOutput) -> @location(0) vec4<f32> {29 return textureSample(texture, texture_sampler, vs.tex_coords);30}