Extract pad stroke face orchestration
This commit is contained in:
@@ -1437,6 +1437,72 @@ void retained_stroke_main_pass_frame_callbacks_preserve_order(pp::tests::Harness
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_pad_face_callbacks_preserve_order(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<bool, 3> dirty_faces { true, false, true };
|
||||
const std::array<glm::vec4, 3> pass_dirty_boxes {
|
||||
glm::vec4(5.0F, 10.0F, 20.0F, 30.0F),
|
||||
glm::vec4(0.0F, 0.0F, 0.0F, 0.0F),
|
||||
glm::vec4(60.0F, 15.0F, 70.0F, 25.0F),
|
||||
};
|
||||
const auto faces = pp::panopainter::make_legacy_canvas_stroke_pad_faces(dirty_faces, pass_dirty_boxes);
|
||||
|
||||
std::vector<std::string> events;
|
||||
std::vector<pp::paint_renderer::CanvasStrokeCopyRegion> copy_regions;
|
||||
std::array<vertex_t, 4> uploaded_quad {};
|
||||
|
||||
const auto result = pp::panopainter::execute_legacy_canvas_stroke_pad_face_callbacks(
|
||||
std::span<const LegacyCanvasStrokePadFace>(faces),
|
||||
pp::renderer::Extent2D { .width = 100, .height = 80 },
|
||||
true,
|
||||
[&](std::span<const vertex_t> vertices) {
|
||||
events.emplace_back("upload:" + std::to_string(vertices.size()));
|
||||
std::copy(vertices.begin(), vertices.end(), uploaded_quad.begin());
|
||||
},
|
||||
[&](int face_index) {
|
||||
events.emplace_back("begin:" + std::to_string(face_index));
|
||||
},
|
||||
[&](int face_index) {
|
||||
events.emplace_back("bind:" + std::to_string(face_index));
|
||||
},
|
||||
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
|
||||
events.emplace_back("copy");
|
||||
copy_regions.push_back(copy_region);
|
||||
},
|
||||
[&](int face_index) {
|
||||
events.emplace_back("unbind:" + std::to_string(face_index));
|
||||
},
|
||||
[&] {
|
||||
events.emplace_back("draw");
|
||||
},
|
||||
[&](int face_index) {
|
||||
events.emplace_back("finish:" + std::to_string(face_index));
|
||||
});
|
||||
|
||||
PP_EXPECT(h, result == 2U);
|
||||
const std::vector<std::string> expected_events {
|
||||
"upload:4",
|
||||
"begin:0",
|
||||
"bind:0",
|
||||
"draw",
|
||||
"unbind:0",
|
||||
"finish:0",
|
||||
"upload:4",
|
||||
"begin:2",
|
||||
"bind:2",
|
||||
"copy",
|
||||
"draw",
|
||||
"unbind:2",
|
||||
"finish:2",
|
||||
};
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
PP_EXPECT(h, copy_regions.size() == 1U);
|
||||
PP_EXPECT(h, faces[0].dirty);
|
||||
PP_EXPECT(h, !faces[1].dirty);
|
||||
PP_EXPECT(h, faces[2].dirty);
|
||||
PP_EXPECT(h, uploaded_quad.size() == 4U);
|
||||
}
|
||||
|
||||
void retained_stroke_pad_executor_copies_destination_for_dirty_faces_only(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<bool, 3> dirty_faces { true, false, true };
|
||||
|
||||
Reference in New Issue
Block a user