Cryptomatte: the GPU path skips the ID colours unless the Colors display reads them, and the CPU path keys the layer in place instead of copying it (#473)

Output is bit-identical (all displays, CPU and GPU). At 2560x1440 with 3 ranks and 2000 IDs on 8 cores the CPU effect drops from ~87-135 ms to ~44-54 ms and the GPU path's aux reduction from 38 to 8 ms for Matte, Preview and Matte Only.
This commit is contained in:
Matej Kozlovský
2026-10-15 23:01:42 +02:00
parent 0311bdc34d
commit 74517a52da
3 changed files with 28 additions and 7 deletions
+4 -1
View File
@@ -278,7 +278,10 @@ fn cryptomatte(e: &mut Enc, ctx: &EffectCtx, b: GBuf, a: &AuxChannels) -> Option
let sel = effectcraft_effects::selection_hashes(pr.s("selection"), manifest);
// Per aux pixel: coverage-weighted ID colours (RGB) and the selection's coverage (A), on all
// cores with the rank planes resolved once.
let img = effectcraft_effects::crypto_aux_image(a, &layer, &sel);
// The ID colours are only read by the Colors display; Matte, Preview and Matte Only need the
// matte alone.
let colors = pr.e("display") == 0 && !pr.b("matteOnly");
let img = effectcraft_effects::crypto_aux_image_with(a, &layer, &sel, colors);
let tex = e.g.upload_image(&img)?;
let plane = lookup(e, &b, a, &tex, [0.5, 0.5], [0.0; 4]);
let mut p = op(7);