Merge branch 'worktree-agent-a75c901968abfa183' into integration
# Conflicts: # core/dr-gpu/src/adjust.rs # core/dr-pipeline/ops/README.md # core/dr-pipeline/src/lib.rs # core/dr-pipeline/src/ops/mod.rs # ui/dr-ui/src/develop.rs
This commit is contained in:
+35
-23
@@ -108,33 +108,45 @@ mod tests {
|
||||
assert!(!g.is_neutral());
|
||||
let shader = g.compose();
|
||||
|
||||
// A neighbourhood operation contributes no fused fragment. That is not
|
||||
// an omission: it reads pixels it is not writing, the fused contract
|
||||
// hands a fragment a colour with no way back to a coordinate, and
|
||||
// `compose_full` filters it out rather than emitting an empty block
|
||||
// that would read as an operation doing nothing (see `crate::detail`).
|
||||
// The chain has two kinds of operation in it and they arrive in
|
||||
// different places: a point operation is a block in the fused shader,
|
||||
// while a neighbourhood operation is a pass of the detail chain and
|
||||
// contributes no fused block at all — it reads pixels it is not
|
||||
// writing, and a fused fragment is handed a colour with no coordinate.
|
||||
//
|
||||
// So the count is against the operations that *can* be fused, and the
|
||||
// ones that cannot are named by the detail chain rather than by a list
|
||||
// written here — which is what keeps this test correct as sharpening,
|
||||
// noise reduction and clarity arrive, rather than weakening it into
|
||||
// "most of them appear".
|
||||
// So the assertion is that each operation reaches exactly one of the
|
||||
// two, checked against the chain rather than a literal, and phrased so
|
||||
// that adding either kind extends it without an edit here. The XOR is
|
||||
// the point: a plain count of fused blocks cannot tell "moved to the
|
||||
// detail stage" from "vanished from both", and this test has now been
|
||||
// broken three times by exactly that ambiguity.
|
||||
//
|
||||
// Composed at source resolution deliberately: an acutance operation's
|
||||
// radius is in source pixels, and on a proxy it may honestly decline
|
||||
// to draw at all (`RenderScale::resolves`), which would leave it out
|
||||
// of both halves and make this count agree for the wrong reason.
|
||||
let detail = g.compose_detail(crate::detail::RenderScale::full((4096, 4096)));
|
||||
let neighbourhood: std::collections::BTreeSet<&str> = detail
|
||||
.passes
|
||||
.iter()
|
||||
.map(|p| p.label.split('/').next().expect("<op id>/<pass label>"))
|
||||
.collect();
|
||||
|
||||
// Composed at 1:1 deliberately. An acutance operation's radius is in
|
||||
// source pixels, so on a proxy it may honestly decline to draw at all
|
||||
// (`RenderScale::resolves`) — which would put it in neither half and
|
||||
// make the assertion fail for a reason that is not a defect.
|
||||
let scale = g.render_scale((4000, 3000), (4000, 3000));
|
||||
let detail = g.compose_detail(scale);
|
||||
let mut fused_blocks = 0;
|
||||
for desc in g.descriptors() {
|
||||
let id = desc.id.0;
|
||||
let point = shader.source.contains(&format!("---- {id} ----"));
|
||||
let neighbourhood = detail
|
||||
.passes
|
||||
.iter()
|
||||
.any(|p| p.label.starts_with(&format!("{id}/")));
|
||||
assert!(
|
||||
point ^ neighbourhood,
|
||||
"{id} reaches {} of the two stages; an active operation \
|
||||
belongs to exactly one",
|
||||
if point { "both" } else { "neither" }
|
||||
);
|
||||
fused_blocks += usize::from(point);
|
||||
}
|
||||
assert_eq!(
|
||||
shader.source.matches("---- ").count(),
|
||||
g.descriptors().len() - neighbourhood.len(),
|
||||
"every operation that can be a fused fragment should appear"
|
||||
fused_blocks,
|
||||
"the fused shader carries a block nothing in the chain asked for"
|
||||
);
|
||||
|
||||
// And each neighbourhood operation is genuinely absent from the fused
|
||||
|
||||
Reference in New Issue
Block a user