Add stroke mix order regression

This commit is contained in:
2026-06-13 22:57:22 +02:00
parent 56d459623d
commit e7d96bfdc4
3 changed files with 122 additions and 0 deletions

View File

@@ -3172,6 +3172,88 @@ void canvas_blend_gate_combines_layer_and_stroke_complexity(pp::tests::Harness&
PP_EXPECT(h, plan.value().path == StrokeCompositePath::framebuffer_fetch);
}
void legacy_canvas_stroke_mix_executor_preserves_plane_callback_order(pp::tests::Harness& h)
{
std::vector<std::string> steps;
std::array<pp::panopainter::LegacyCanvasStrokeMixPassPlane, 3> planes {
pp::panopainter::LegacyCanvasStrokeMixPassPlane {
.index = 4,
.visible = true,
.has_target = true,
.opacity = 0.75f,
.mvp = glm::mat4(1.0f),
},
pp::panopainter::LegacyCanvasStrokeMixPassPlane {
.index = 5,
.visible = false,
.has_target = true,
.opacity = 0.5f,
.mvp = glm::mat4(1.0f),
},
pp::panopainter::LegacyCanvasStrokeMixPassPlane {
.index = 6,
.visible = true,
.has_target = false,
.opacity = 0.9f,
.mvp = glm::mat4(1.0f),
},
};
const auto result = pp::panopainter::execute_legacy_canvas_stroke_mix_pass(
pp::panopainter::LegacyCanvasStrokeMixPassRequest {
.context = "mix-order",
.resolution = glm::vec2(256.0f, 128.0f),
.planes = planes,
.bind_mix_samplers = [&] {
steps.emplace_back("bind-mix");
},
.unbind_mix_samplers = [&] {
steps.emplace_back("unbind-mix");
},
.setup_plane_shader = [&](int index, const glm::mat4& mvp) {
steps.emplace_back("setup:" + std::to_string(index) + ":" + std::to_string(mvp[0][0]));
},
.bind_layer_texture = [&](int index) {
steps.emplace_back("bind-layer:" + std::to_string(index));
},
.bind_stroke_texture = [&](int index) {
steps.emplace_back("bind-stroke:" + std::to_string(index));
},
.bind_mask_texture = [&](int index) {
steps.emplace_back("bind-mask:" + std::to_string(index));
},
.draw_plane = [&] {
steps.emplace_back("draw");
},
.unbind_mask_texture = [&](int index) {
steps.emplace_back("unbind-mask:" + std::to_string(index));
},
.unbind_stroke_texture = [&](int index) {
steps.emplace_back("unbind-stroke:" + std::to_string(index));
},
.unbind_layer_texture = [&](int index) {
steps.emplace_back("unbind-layer:" + std::to_string(index));
},
});
PP_EXPECT(h, result.ok);
PP_EXPECT(h, result.composed_planes == 1);
const std::vector<std::string> expected {
"bind-mix",
"setup:4:1",
"bind-layer:4",
"bind-stroke:4",
"bind-mask:4",
"draw",
"unbind-mask:4",
"unbind-stroke:4",
"unbind-layer:4",
"unbind-mix",
};
PP_EXPECT(h, steps == expected);
}
void legacy_canvas_draw_merge_temporary_erase_helper_preserves_order(pp::tests::Harness& h)
{
std::vector<std::string> order;
@@ -3576,6 +3658,9 @@ int main()
harness.run("plans_canvas_blend_gate_from_persisted_indices", plans_canvas_blend_gate_from_persisted_indices);
harness.run("canvas_blend_gate_preserves_legacy_fallbacks", canvas_blend_gate_preserves_legacy_fallbacks);
harness.run("canvas_blend_gate_combines_layer_and_stroke_complexity", canvas_blend_gate_combines_layer_and_stroke_complexity);
harness.run(
"legacy_canvas_stroke_mix_executor_preserves_plane_callback_order",
legacy_canvas_stroke_mix_executor_preserves_plane_callback_order);
harness.run(
"legacy_canvas_draw_merge_temporary_erase_helper_preserves_order",
legacy_canvas_draw_merge_temporary_erase_helper_preserves_order);