Files
wgpu/tests/gpu-tests/shader_view_format/view_format.wgsl
2025-02-23 14:06:34 -05:00

12 lines
423 B
WebGPU Shading Language

@vertex
fn vs_main(@builtin(vertex_index) vertexIndex: u32) -> @builtin(position) vec4<f32> {
let uv: vec2<f32> = vec2<f32>(f32((vertexIndex << 1u) & 2u), f32(vertexIndex & 2u));
return vec4<f32>(uv * 2.0 - 1.0, 0.0, 1.0);
}
@group(0) @binding(0) var tex: texture_2d<f32>;
@fragment
fn fs_main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> {
return textureLoad(tex, vec2<i32>(coord.xy), 0);
}