Extract preview main pass orchestration

This commit is contained in:
2026-06-13 18:31:42 +02:00
parent 86777b26b5
commit fe16a6a270
5 changed files with 197 additions and 39 deletions

View File

@@ -2540,6 +2540,77 @@ void legacy_node_stroke_preview_pass_sequence_preserves_dual_main_and_composite_
PP_EXPECT(h, !missing_required);
}
void legacy_node_stroke_preview_main_live_pass_preserves_order(pp::tests::Harness& h)
{
struct Frame {
int id = 0;
};
std::vector<std::string> steps;
const auto run = [&](std::vector<Frame> frames) {
steps.clear();
const bool ok = pp::panopainter::execute_legacy_node_stroke_preview_main_live_pass<Frame>(
pp::panopainter::LegacyNodeStrokePreviewMainLivePassRequestT<Frame> {
.setup_blend_uniforms = [&] {
steps.emplace_back("setup_blend");
},
.bind_main_pass_textures = [&] {
steps.emplace_back("bind_textures");
},
.clear_target = [&] {
steps.emplace_back("clear");
},
.compute_frames = [&] {
steps.emplace_back("compute");
return frames;
},
.before_frame = [&](Frame& frame) {
steps.emplace_back("before:" + std::to_string(frame.id));
},
.setup_sample_shader = [&](Frame& frame) {
steps.emplace_back("setup:" + std::to_string(frame.id));
},
.draw_sample = [&](Frame& frame) {
steps.emplace_back("draw:" + std::to_string(frame.id));
},
.copy_pass_result = [&] {
steps.emplace_back("copy");
},
.finish_main_pass = [&] {
steps.emplace_back("finish");
},
});
PP_EXPECT(h, ok);
};
run({});
PP_EXPECT(h, steps == std::vector<std::string> {
"setup_blend",
"bind_textures",
"compute",
"clear",
"copy",
"finish",
});
run({ Frame { .id = 7 } });
PP_EXPECT(h, steps == std::vector<std::string> {
"setup_blend",
"bind_textures",
"compute",
"clear",
"before:7",
"setup:7",
"draw:7",
"copy",
"finish",
});
const bool invalid = pp::panopainter::execute_legacy_node_stroke_preview_main_live_pass<Frame>(
pp::panopainter::LegacyNodeStrokePreviewMainLivePassRequestT<Frame> {});
PP_EXPECT(h, !invalid);
}
void legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_inputs(pp::tests::Harness& h)
{
const auto plan = pp::panopainter::plan_legacy_node_stroke_preview_stroke_setup(
@@ -3130,6 +3201,9 @@ int main()
harness.run(
"legacy_node_stroke_preview_pass_sequence_preserves_dual_main_and_composite_order",
legacy_node_stroke_preview_pass_sequence_preserves_dual_main_and_composite_order);
harness.run(
"legacy_node_stroke_preview_main_live_pass_preserves_order",
legacy_node_stroke_preview_main_live_pass_preserves_order);
harness.run(
"legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_inputs",
legacy_node_stroke_preview_stroke_setup_plan_preserves_curve_and_dual_inputs);