// Vertex shader struct VertexOutput { @builtin(position) clip_position: vec4, @location(0) tex_coords: vec2, }; @vertex fn vs_main( @builtin(vertex_index) in_vertex_index: u32, ) -> VertexOutput { var out: VertexOutput; let uv = vec2(f32((in_vertex_index << 1u) & 2u), f32(in_vertex_index & 2u)); out.clip_position = vec4(uv * 2.0 - 1.0, 0.0, 1.0); out.clip_position.y = -out.clip_position.y; out.tex_coords = uv; return out; } // Fragment shader @group(0) @binding(0) var t_diffuse: texture_2d; @group(0) @binding(1) var s_diffuse: sampler; @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { return textureSample(t_diffuse, s_diffuse, in.tex_coords); }