Refine stroke mix pass boundary
This commit is contained in:
@@ -984,6 +984,77 @@ void retained_stroke_live_pass_clears_before_traversal_and_copies_afterwards(pp:
|
||||
PP_EXPECT(h, pass_dirty_faces[2]);
|
||||
}
|
||||
|
||||
void retained_stroke_live_pass_retains_previous_pass_dirty_union_without_override(pp::tests::Harness& h)
|
||||
{
|
||||
StrokeFrame frame;
|
||||
frame.id = 11;
|
||||
frame.shapes[1] = {
|
||||
vertex_t(glm::vec2(4.0F, 5.0F)),
|
||||
vertex_t(glm::vec2(6.0F, 5.0F)),
|
||||
vertex_t(glm::vec2(6.0F, 7.0F)),
|
||||
};
|
||||
|
||||
std::array<StrokeFrame, 1> frames { frame };
|
||||
std::array<glm::vec4, 6> accumulated_dirty_boxes;
|
||||
std::array<glm::vec4, 6> pass_dirty_boxes;
|
||||
accumulated_dirty_boxes.fill(glm::vec4(64.0F, 64.0F, 0.0F, 0.0F));
|
||||
pass_dirty_boxes.fill(glm::vec4(64.0F, 64.0F, 0.0F, 0.0F));
|
||||
accumulated_dirty_boxes[1] = glm::vec4(7.0F, 8.0F, 9.0F, 10.0F);
|
||||
pass_dirty_boxes[1] = glm::vec4(20.0F, 20.0F, 21.0F, 21.0F);
|
||||
std::array<bool, 6> include_in_committed_dirty_box { true, true, true, true, true, true };
|
||||
std::array<bool, 6> committed_dirty_faces {};
|
||||
std::array<bool, 6> pass_dirty_faces {};
|
||||
|
||||
std::vector<std::string> events;
|
||||
std::array<DummyFramebuffer, 6> face_framebuffers {};
|
||||
for (int face_index = 0; face_index < 6; ++face_index) {
|
||||
face_framebuffers[face_index].events = &events;
|
||||
face_framebuffers[face_index].face_index = face_index;
|
||||
}
|
||||
|
||||
const auto executed_faces = pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
|
||||
frames,
|
||||
pp::renderer::Extent2D { .width = 64, .height = 64 },
|
||||
accumulated_dirty_boxes,
|
||||
pass_dirty_boxes,
|
||||
include_in_committed_dirty_box,
|
||||
[&](StrokeFrame& current_frame) {
|
||||
events.push_back("begin-frame:" + std::to_string(current_frame.id));
|
||||
},
|
||||
[&](StrokeFrame&, int face_index, std::span<const vertex_t> vertices) {
|
||||
events.push_back(
|
||||
"prepare:" + std::to_string(face_index) + ":" + std::to_string(vertices.size()));
|
||||
},
|
||||
[&](StrokeFrame&, int face_index, std::span<const vertex_t>) {
|
||||
events.push_back("execute:" + std::to_string(face_index));
|
||||
return glm::vec4(1.0F, 2.0F, 3.0F, 4.0F);
|
||||
},
|
||||
face_framebuffers,
|
||||
false,
|
||||
committed_dirty_faces,
|
||||
pass_dirty_faces);
|
||||
|
||||
PP_EXPECT(h, executed_faces == 1U);
|
||||
const std::vector<std::string> expected_events {
|
||||
"begin-frame:11",
|
||||
"prepare:1:3",
|
||||
"bind:1",
|
||||
"execute:1",
|
||||
"unbind:1",
|
||||
};
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
PP_EXPECT(h, nearly_equal(accumulated_dirty_boxes[1].x, 1.0F));
|
||||
PP_EXPECT(h, nearly_equal(accumulated_dirty_boxes[1].y, 2.0F));
|
||||
PP_EXPECT(h, nearly_equal(accumulated_dirty_boxes[1].z, 9.0F));
|
||||
PP_EXPECT(h, nearly_equal(accumulated_dirty_boxes[1].w, 10.0F));
|
||||
PP_EXPECT(h, nearly_equal(pass_dirty_boxes[1].x, 1.0F));
|
||||
PP_EXPECT(h, nearly_equal(pass_dirty_boxes[1].y, 2.0F));
|
||||
PP_EXPECT(h, nearly_equal(pass_dirty_boxes[1].z, 21.0F));
|
||||
PP_EXPECT(h, nearly_equal(pass_dirty_boxes[1].w, 21.0F));
|
||||
PP_EXPECT(h, committed_dirty_faces[1]);
|
||||
PP_EXPECT(h, pass_dirty_faces[1]);
|
||||
}
|
||||
|
||||
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 };
|
||||
@@ -1265,6 +1336,9 @@ int main()
|
||||
harness.run(
|
||||
"retained_stroke_live_pass_clears_before_traversal_and_copies_afterwards",
|
||||
retained_stroke_live_pass_clears_before_traversal_and_copies_afterwards);
|
||||
harness.run(
|
||||
"retained_stroke_live_pass_retains_previous_pass_dirty_union_without_override",
|
||||
retained_stroke_live_pass_retains_previous_pass_dirty_union_without_override);
|
||||
harness.run(
|
||||
"retained_stroke_pad_executor_copies_destination_for_dirty_faces_only",
|
||||
retained_stroke_pad_executor_copies_destination_for_dirty_faces_only);
|
||||
|
||||
Reference in New Issue
Block a user