Extract pad destination dispatch helper

This commit is contained in:
2026-06-13 23:14:35 +02:00
parent 59a83468a6
commit 4bca83982c
4 changed files with 69 additions and 23 deletions

View File

@@ -1968,6 +1968,47 @@ void legacy_canvas_stroke_dual_shader_wrapper_preserves_setup(pp::tests::Harness
PP_EXPECT(h, steps.size() == 1U);
}
void legacy_canvas_stroke_pad_destination_dispatch_preserves_order(pp::tests::Harness& h)
{
std::vector<std::string> steps;
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
[&](int slot) {
steps.emplace_back("activate:" + std::to_string(slot));
},
[&](int face_index) {
steps.emplace_back("bind:" + std::to_string(face_index));
},
[&](int face_index) {
steps.emplace_back("unbind:" + std::to_string(face_index));
},
4);
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
.slot = 1,
},
},
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
.slot = 1,
},
},
dispatch);
const std::vector<std::string> expected {
"activate:1",
"bind:4",
"activate:1",
"unbind:4",
};
PP_EXPECT(h, steps == expected);
}
void plans_canvas_stroke_commit_erase_sequence(pp::tests::Harness& h)
{
const auto plan = plan_canvas_stroke_commit_sequence(
@@ -3849,6 +3890,9 @@ int main()
harness.run(
"legacy_canvas_stroke_pad_copy_region_preserves_coordinates",
legacy_canvas_stroke_pad_copy_region_preserves_coordinates);
harness.run(
"legacy_canvas_stroke_pad_destination_dispatch_preserves_order",
legacy_canvas_stroke_pad_destination_dispatch_preserves_order);
harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence);
harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence);
harness.run(