Share retained stroke live pass helper

This commit is contained in:
2026-06-13 10:17:47 +02:00
parent 39cc62f41f
commit bc624ceb8d
4 changed files with 58 additions and 9 deletions

View File

@@ -315,6 +315,42 @@ std::size_t execute_legacy_canvas_stroke_frame_samples_with_dirty_tracking(
return executed_faces;
}
template <typename Frames, typename BeginFrame, typename BeginFace, typename ExecuteSample, typename FinishFace>
std::size_t execute_legacy_canvas_stroke_live_pass_with_dirty_tracking(
Frames&& frames,
pp::renderer::Extent2D extent,
std::span<glm::vec4> accumulated_dirty_boxes,
std::span<glm::vec4> pass_dirty_boxes,
std::span<const bool> include_in_committed_dirty_box,
BeginFrame&& begin_frame,
BeginFace&& begin_face,
ExecuteSample&& execute_sample,
FinishFace&& finish_face,
bool preserve_sample_dirty_as_pass_dirty = false,
std::span<bool> committed_dirty_faces = {},
std::span<bool> pass_dirty_faces = {})
{
return execute_legacy_canvas_stroke_frame_samples_with_dirty_tracking(
std::forward<Frames>(frames),
extent,
accumulated_dirty_boxes,
pass_dirty_boxes,
include_in_committed_dirty_box,
std::forward<BeginFrame>(begin_frame),
std::forward<BeginFace>(begin_face),
std::forward<ExecuteSample>(execute_sample),
[&](auto&, int, auto&, auto& request) {
if (preserve_sample_dirty_as_pass_dirty) {
request.previous_pass_dirty_box = request.sample_dirty_box;
}
},
[&](auto& frame, int face_index, auto& vertices, glm::vec4 sample_dirty_box) {
finish_face(frame, face_index, vertices, sample_dirty_box);
},
committed_dirty_faces,
pass_dirty_faces);
}
[[nodiscard]] inline pp::paint_renderer::CanvasStrokeBox legacy_canvas_stroke_box(glm::vec4 box) noexcept
{
return pp::paint_renderer::CanvasStrokeBox {