Skip to main content

BLOOM_LINEAR

Constant BLOOM_LINEAR 

Source
pub const BLOOM_LINEAR: &str = r#"
@group(0) @binding(3) var bloom_tex: texture_2d<f32>;
@group(0) @binding(4) var bloom_sampler: sampler;

fn bloom_uv(p: vec2<u32>) -> vec2<f32> {
    let size = textureDimensions(bloom_tex);
    let small = min(size, post.extent.zw);
    let ratio = select(vec2<f32>(small) / vec2<f32>(size), vec2<f32>(1.0), small == size);
    let edge = select(vec2<f32>(1e30), (vec2<f32>(small) - vec2<f32>(0.5)) / vec2<f32>(size), small < size);
    return min((vec2<f32>(p) + vec2<f32>(0.5)) / vec2<f32>(src_dim()) * ratio, edge);
}
"#;