From ec4283e37f17373c7ac05f189e6efa8529ac3b9d Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 22 Aug 2026 19:34:24 +0200 Subject: [PATCH] Finish reconciling the whole-chain tests the three kernels each rewrote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sharpening, noise reduction and clarity were written in parallel and each rewrote the same two tests, which had counted one fused block per operation — true only while every operation was a point function. Kept the exclusive-or formulation: each operation must reach exactly one of the two stages. A count cannot tell "moved to the detail stage" from "vanished from both", and that ambiguity is what broke these tests three times over. The merge left two fragments of the versions it replaced — a loop over a set that no longer exists, and the tail of an assertion whose head was gone. The loop is not restored: `point ^ neighbourhood` already asserts per operation what it checked over the set. The assertion is, because it catches a different fault from the exclusive-or — a block in the shader that nothing in the chain asked for, rather than an operation in the wrong stage. --- core/dr-gpu/src/adjust.rs | 11 +++++++++++ core/dr-pipeline/src/lib.rs | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/dr-gpu/src/adjust.rs b/core/dr-gpu/src/adjust.rs index d842a2d..becc922 100644 --- a/core/dr-gpu/src/adjust.rs +++ b/core/dr-gpu/src/adjust.rs @@ -1501,6 +1501,17 @@ mod tests { ); fused_blocks += usize::from(point); } + + // The count the loop above accumulated, plus framing — which emits a + // stage of its own rather than an operation block and is not in + // `descriptors`. Asserted as well as the per-operation exclusive-or + // because the two catch different faults: the XOR catches an operation + // in the wrong stage, this catches a block in the shader that nothing + // in the chain asked for. + assert_eq!( + shader.source.matches("---- ").count(), + fused_blocks + 1, + "the fused shader carries a block nothing in the chain asked for" ); assert!( shader.source.contains("---- framing ----"), diff --git a/core/dr-pipeline/src/lib.rs b/core/dr-pipeline/src/lib.rs index be7f1bd..2c23fb1 100644 --- a/core/dr-pipeline/src/lib.rs +++ b/core/dr-pipeline/src/lib.rs @@ -148,16 +148,6 @@ mod tests { fused_blocks, "the fused shader carries a block nothing in the chain asked for" ); - - // And each neighbourhood operation is genuinely absent from the fused - // shader rather than merely uncounted — the arithmetic above would be - // satisfied just as well by two errors that cancelled. - for id in &neighbourhood { - assert!( - !shader.source.contains(&format!("---- {id} ----")), - "{id} reads its neighbours and cannot be a fused fragment" - ); - } } #[test]