struct VertexOutput { @builtin(position) position: vec4, @location(0) uv: vec2, } struct CompositeUniforms { uv_scale: vec2, _pad: vec2, } var POSITIONS: array, 6> = array, 6>( vec2(-1.0, 1.0), vec2(-1.0, -1.0), vec2( 1.0, 1.0), vec2(-1.0, -1.0), vec2( 1.0, -1.0), vec2( 1.0, 1.0), ); var UVS: array, 6> = array, 6>( vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), vec2(1.0, 0.0), ); @vertex fn vs_main(@builtin(vertex_index) index: u32) -> VertexOutput { var output: VertexOutput; output.position = vec4(POSITIONS[index], 0.0, 1.0); output.uv = UVS[index]; return output; } @group(0) @binding(0) var resolved_texture: texture_2d; @group(0) @binding(1) var resolved_sampler: sampler; @group(0) @binding(2) var uniforms: CompositeUniforms; @fragment fn fs_main(input: VertexOutput) -> @location(0) vec4 { return textureSample(resolved_texture, resolved_sampler, input.uv * uniforms.uv_scale); }