Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

GPU6: invert alpha keeps the CPU's 1e-6 threshold (#30)

Manuel Camacho83e6fe7eda2c
diff --git a/crates/gpu/src/fx.wgsl b/crates/gpu/src/fx.wgsl
index 410e69a68..6e617b7c3 100644
--- a/crates/gpu/src/fx.wgsl
+++ b/crates/gpu/src/fx.wgsl
@@ -442,8 +442,9 @@ fn pixel(op: u32, p: vec2<i32>) -> vec4<f32> {
let o = ld(p);
let a = o.a;
let na = 1.0 - a;
+ // (the CPU's threshold; `na / a` is only used when a > 1e-6)
var k = 0.0;
- if a > 1e-4 {
+ if a > 1e-6 {
k = na / a;
}
let blend = u.p0.x;