summaryrefslogtreecommitdiffstats
path: root/assets/shaders/canvas.wgsl
blob: 3be1a77f81a21fe074150cae872d825dca512236 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
struct VertexInput {
    @location(0) position: vec3<f32>,
    @location(1) uv: vec2<f32>
};

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

@vertex
fn vs_main(
    model: VertexInput,
) -> VertexOutput {
    var out: VertexOutput;

    out.clip_position = vec4<f32>(model.position, 1.0);
    out.uv = model.uv;

    return out;
}

@group(0) @binding(0)
var canvas_texture: texture_2d<f32>;
@group(0) @binding(1)
var canvas_sampler: sampler;

@fragment
fn fs_main(in: VertexOutput
) -> @location(0) vec4<f32> {
    return textureSample(canvas_texture, canvas_sampler, in.uv);
}