summaryrefslogblamecommitdiffstats
path: root/wgpu/src/shader/offscreen_blit.wgsl
blob: 08952d62f4ad1309b2c6fa1c07c52c92e1f7a7e3 (plain) (tree)
1
2
3
4
5
6
7
8

                                                         
 


                                        

 







                                                
 

                                                       
 
                  
 




                                                                 
@group(0) @binding(0) var frame_texture: texture_2d<f32>;
@group(0) @binding(1) var frame_sampler: sampler;

struct VertexInput {
    @location(0) v_pos: vec2<f32>,
    @location(1) texel_coord: vec2<f32>,
}

struct VertexOutput {
    @builtin(position) clip_pos: vec4<f32>,
    @location(0) uv: vec2<f32>,
}

@vertex
fn vs_main(input: VertexInput) -> VertexOutput {
    var output: VertexOutput;

    output.clip_pos = vec4<f32>(input.v_pos, 0.0, 1.0);
    output.uv = input.texel_coord;

    return output;
}

@fragment
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
    return textureSample(frame_texture, frame_sampler, input.uv);
}