Constant FINISH_WGSL
Source pub const FINISH_WGSL: &str = r#"
@group(0) @binding(0) var flat_source: texture_2d<f32>;
@vertex
fn flat_finish_vertex(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
let xy = array<vec2f, 3>(vec2f(-1.0, -1.0), vec2f(3.0, -1.0), vec2f(-1.0, 3.0));
return vec4f(xy[index], 0.0, 1.0);
}
fn flat_finish_decode(c: vec3f) -> vec3f {
return select(pow((c + 0.055) / 1.055, vec3f(2.4)), c / 12.92, c <= vec3f(0.04045));
}
@fragment
fn flat_finish_copy(@builtin(position) position: vec4f) -> @location(0) vec4f {
return textureLoad(flat_source, vec2i(position.xy), 0);
}
@fragment
fn flat_finish_linear(@builtin(position) position: vec4f) -> @location(0) vec4f {
let c = textureLoad(flat_source, vec2i(position.xy), 0);
if (c.a <= 0.0) {
return vec4f(0.0);
}
return vec4f(flat_finish_decode(c.rgb / c.a) * c.a, c.a);
}
"#;