Let the fully-active chain test account for both stages
Activating every operation now activates a kernel too, and a kernel emits no block in the fused shader. Assert that each operation reaches exactly one of the fused pass and the detail chain, rather than counting fused blocks against the length of the chain.
This commit is contained in:
@@ -107,12 +107,38 @@ mod tests {
|
|||||||
let g = fully_active();
|
let g = fully_active();
|
||||||
assert!(!g.is_neutral());
|
assert!(!g.is_neutral());
|
||||||
let shader = g.compose();
|
let shader = g.compose();
|
||||||
// Counted against the chain rather than a literal, so adding an
|
|
||||||
// operation does not require editing this test.
|
// 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 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.
|
||||||
|
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!(
|
assert_eq!(
|
||||||
shader.source.matches("---- ").count(),
|
shader.source.matches("---- ").count(),
|
||||||
g.descriptors().len(),
|
fused_blocks,
|
||||||
"every operation in the chain should appear"
|
"the fused shader carries a block nothing in the chain asked for"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user