Harbor

branch main
showing the latest snapshot on main
derivatives_test.luma 356 B · Plain text
shader/tests/shaders/derivatives_test.luma 0644 Raw
-- Test: dfdx, dfdy, fwidth, step builtins

uniform albedo_tex: sampler2D @group(0)

@entry(fragment)
function fs_main(@location(0) uv: vec2) -> vec4
    let color = sample(albedo_tex, uv)
    let dx = dfdx(color.r)
    let dy = dfdy(color.r)
    let fw = fwidth(color.r)
    let edge = step(0.1, fw)
    return vec4(color.rgb * (1.0 - edge), color.a)
end