blob: a70b48df156854a063df517ee36743962b6c2288 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Circle mask render shader
// Samples mask and draws green outside the circle
@group(0) @binding(0) var mask_tex: texture_2d<f32>;
@group(0) @binding(1) var mask_sampler: sampler;
#include "common_uniforms"
#include "render/fullscreen_vs"
@group(0) @binding(2) var<uniform> uniforms: CommonUniforms;
@fragment fn fs_main(@builtin(position) p: vec4f) -> @location(0) vec4f {
let uv = p.xy / uniforms.resolution;
let mask_value = textureSample(mask_tex, mask_sampler, uv).r;
if (mask_value > 0.5) {
discard;
}
return vec4f(0.0, 1.0, 0.0, 1.0);
}
|