Match Dissolve on the GPU compositor for effects, adjustments, and clipped fills.

The CPU compositor already chose the layer or the backdrop per pixel. The GPU path still mixed those same cases by opacity, so a Dissolve layer with effects disagreed with the CPU result.
This commit is contained in:
Vikram Bhaskaran committed 2026-10-13 17:04:30 +11:00
1 parent b5dbf608b3
commit b157affd9e
1 file changed
+20 -1
+20 -1
View File
@@ -828,6 +828,14 @@ fn fs_atop(in: VOut) -> @location(0) vec4<f32> {
let base = textureLoad(tex_a, p, 0);
if (base.a <= 0.0) { return base; }
let s = textureLoad(tex_b, p, 0);
// A clipped Dissolve fill picks the source or the base. Mixing by coverage grays it (#3052).
if (op.mode == M_DISSOLVE) {
if (dissolve_noise(doc_px(p)) < s.a * op.opacity * base.a) {
let r = composite(M_NORMAL, vec4(base.rgb, 1.0), vec4(s.rgb, 1.0), 1.0);
return vec4(r.rgb, base.a);
}
return base;
}
let r = composite_g(op.mode, vec4(base.rgb, 1.0), s, op.opacity, (op.flags & F_TEXT_GAMMA) != 0u);
return vec4(r.rgb, base.a);
}
@@ -850,6 +858,11 @@ fn fs_adjmix(in: VOut) -> @location(0) vec4<f32> {
let k = op.opacity * mask_value(doc_px(p));
if (k <= 0.0) { return b; }
let a = textureLoad(tex_b, p, 0);
// Dissolve keeps the adjusted colour or the backdrop (#3050).
if (op.mode == M_DISSOLVE) {
if (dissolve_noise(doc_px(p)) < k) { return vec4(a.rgb, b.a); }
return b;
}
let bl = blend_rgb(op.mode, b.rgb, a.rgb);
return vec4(b.rgb + (bl - b.rgb) * k, b.a);
}
@@ -1103,7 +1116,13 @@ fn fs_fxmerge(in: VOut) -> @location(0) vec4<f32> {
let atop = (op.flags & F_ATOP) != 0u;
var before = c;
if (atop) { before = vec4(c.rgb, 1.0); }
let o = mix_premul(before, w, op.opacity);
// Dissolve chooses the finished layer or the backdrop. Mixing by opacity grays it (#3051).
var o: vec4<f32>;
if (op.mode == M_DISSOLVE) {
o = select(before, w, dissolve_noise(doc_px(p)) < op.opacity);
} else {
o = mix_premul(before, w, op.opacity);
}
if (atop) {
if (c.a > 0.0) { return vec4(o.rgb, c.a); }
return c;