1@group(0) @binding(0) var frame: texture_2d<f32>;
2@group(0) @binding(1) var frame_sampler: sampler;
3
4struct Vertex {
5 @builtin(position) position: vec4<f32>,
6 @location(0) uv: vec2<f32>,
7}
8
9@vertex
10fn vertex(@builtin(vertex_index) index: u32) -> Vertex {
11 let corner = vec2<f32>(f32((index << 1u) & 2u), f32(index & 2u));
12 return Vertex(vec4<f32>(corner * 2.0 - 1.0, 0.0, 1.0), vec2<f32>(corner.x, 1.0 - corner.y));
13}
14
15@fragment
16fn fragment(v: Vertex) -> @location(0) vec4<f32> {
17 return textureSample(frame, frame_sampler, v.uv);
18}