1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- Test: sample_level and sample_shadow builtins
struct Params
bias: float
end
uniform params: Params @group(0) @binding(0)
uniform diffuse_tex: sampler2D @group(0)
uniform shadow_map: sampler2DShadow @group(1)
@entry(fragment)
function fs_main(@location(0) uv: vec2, @location(1) shadow_uv: vec2) -> vec4
let mip_color = sample_level(diffuse_tex, uv, params.bias)
let shadow = sample_shadow(shadow_map, shadow_uv, 0.5)
return vec4(mip_color.rgb * shadow, mip_color.a)
end