Wrap stroke mix shell bundle

This commit is contained in:
2026-06-13 19:21:42 +02:00
parent a428f77db6
commit a6855fca05
5 changed files with 132 additions and 58 deletions

View File

@@ -1903,6 +1903,79 @@ void retained_stroke_mix_pass_setup_builder_preserves_boundaries(pp::tests::Harn
PP_EXPECT(h, events[1] == "end");
}
void retained_stroke_mix_pass_shell_builder_preserves_combined_wiring(pp::tests::Harness& h)
{
const std::array<LegacyCanvasStrokeMixPassPlane, 1> planes {
LegacyCanvasStrokeMixPassPlane { .index = 2, .visible = true, .has_target = true, .opacity = 1.0F },
};
std::vector<std::string> events;
const auto shell = pp::panopainter::make_legacy_canvas_stroke_mix_pass_shell(
[&] { events.emplace_back("begin"); },
[&] { events.emplace_back("end"); },
"mix-shell",
glm::vec2(64.0F, 32.0F),
planes,
[&] { events.emplace_back("bind-samplers"); },
[&] { events.emplace_back("unbind-samplers"); },
[&](int plane_index, const glm::mat4&) {
events.emplace_back("setup:" + std::to_string(plane_index));
},
[&](int plane_index) {
events.emplace_back("bind-layer:" + std::to_string(plane_index));
},
[&](int plane_index) {
events.emplace_back("bind-stroke:" + std::to_string(plane_index));
},
[&](int plane_index) {
events.emplace_back("bind-mask:" + std::to_string(plane_index));
},
[&] { events.emplace_back("draw"); },
[&](int plane_index) {
events.emplace_back("unbind-mask:" + std::to_string(plane_index));
},
[&](int plane_index) {
events.emplace_back("unbind-stroke:" + std::to_string(plane_index));
},
[&](int plane_index) {
events.emplace_back("unbind-layer:" + std::to_string(plane_index));
});
PP_EXPECT(h, shell.setup.begin);
PP_EXPECT(h, shell.setup.end);
PP_EXPECT(h, shell.request.context == "mix-shell");
PP_EXPECT(h, shell.request.planes.size() == 1U);
shell.setup.begin();
shell.request.bind_mix_samplers();
shell.request.setup_plane_shader(2, glm::mat4(1.0F));
shell.request.bind_layer_texture(2);
shell.request.bind_stroke_texture(2);
shell.request.bind_mask_texture(2);
shell.request.draw_plane();
shell.request.unbind_mask_texture(2);
shell.request.unbind_stroke_texture(2);
shell.request.unbind_layer_texture(2);
shell.request.unbind_mix_samplers();
shell.setup.end();
const std::vector<std::string> expected_events {
"begin",
"bind-samplers",
"setup:2",
"bind-layer:2",
"bind-stroke:2",
"bind-mask:2",
"draw",
"unbind-mask:2",
"unbind-stroke:2",
"unbind-layer:2",
"unbind-samplers",
"end",
};
PP_EXPECT(h, events == expected_events);
}
} // namespace
int main()
@@ -2013,5 +2086,8 @@ int main()
harness.run(
"retained_stroke_mix_pass_setup_builder_preserves_boundaries",
retained_stroke_mix_pass_setup_builder_preserves_boundaries);
harness.run(
"retained_stroke_mix_pass_shell_builder_preserves_combined_wiring",
retained_stroke_mix_pass_shell_builder_preserves_combined_wiring);
return harness.finish();
}