struct VertexOutput { @builtin(position) position: vec4, @location(0) texcoord: vec2 } @vertex fn vs(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput { let pos = array( vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(0.0, 1.0), vec2(1.0, 0.0), vec2(1.0, 1.0) ); var out: VertexOutput; let xy = pos[vertexIndex]; out.position = vec4(xy * 2.0 - 1.0, 0.0, 1.0); out.texcoord = vec2(xy.x, 1.0 - xy.y); return out; } @group(0) @binding(0) var texSampler: sampler; @group(0) @binding(1) var tex: texture_2d; @fragment fn fs(inp: VertexOutput) -> @location(0) vec4 { return textureSample(tex, texSampler, inp.texcoord); }