Extract pad stroke face orchestration
This commit is contained in:
@@ -858,46 +858,42 @@ void Canvas::stroke_draw()
|
||||
m_tex[face_index].unbind();
|
||||
});
|
||||
};
|
||||
[[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_faces(
|
||||
pp::panopainter::LegacyCanvasStrokePadExecutionRequest {
|
||||
.context = "Canvas::stroke_draw",
|
||||
.extent = stroke_extent,
|
||||
.faces = pad_faces,
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.upload_pad_vertices = [&](std::span<const vertex_t> pad_quad) {
|
||||
m_brush_shape.update_vertices(
|
||||
const_cast<vertex_t*>(pad_quad.data()),
|
||||
static_cast<int>(pad_quad.size()));
|
||||
},
|
||||
.begin_face = [&](int face_index) {
|
||||
m_tmp[face_index].bindFramebuffer();
|
||||
},
|
||||
.bind_destination_texture = [&](int face_index) {
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||
pad_destination_texture_binding,
|
||||
make_pad_destination_texture_dispatch(face_index));
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture =
|
||||
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
|
||||
copy_framebuffer_to_texture_2d(
|
||||
copy_region.x,
|
||||
copy_region.y,
|
||||
copy_region.x,
|
||||
copy_region.y,
|
||||
copy_region.width,
|
||||
copy_region.height);
|
||||
},
|
||||
.unbind_destination_texture = [&](int face_index) {
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||
pad_destination_texture_binding,
|
||||
make_pad_destination_texture_dispatch(face_index));
|
||||
},
|
||||
.draw_pad = [&] {
|
||||
m_brush_shape.draw_fill();
|
||||
},
|
||||
.finish_face = [&](int face_index) {
|
||||
m_tmp[face_index].unbindFramebuffer();
|
||||
},
|
||||
[[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_face_callbacks(
|
||||
pad_faces,
|
||||
stroke_extent,
|
||||
copy_stroke_destination,
|
||||
[&](std::span<const vertex_t> pad_quad) {
|
||||
m_brush_shape.update_vertices(
|
||||
const_cast<vertex_t*>(pad_quad.data()),
|
||||
static_cast<int>(pad_quad.size()));
|
||||
},
|
||||
[&](int face_index) {
|
||||
m_tmp[face_index].bindFramebuffer();
|
||||
},
|
||||
[&](int face_index) {
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||
pad_destination_texture_binding,
|
||||
make_pad_destination_texture_dispatch(face_index));
|
||||
},
|
||||
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
|
||||
copy_framebuffer_to_texture_2d(
|
||||
copy_region.x,
|
||||
copy_region.y,
|
||||
copy_region.x,
|
||||
copy_region.y,
|
||||
copy_region.width,
|
||||
copy_region.height);
|
||||
},
|
||||
[&](int face_index) {
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||
pad_destination_texture_binding,
|
||||
make_pad_destination_texture_dispatch(face_index));
|
||||
},
|
||||
[&] {
|
||||
m_brush_shape.draw_fill();
|
||||
},
|
||||
[&](int face_index) {
|
||||
m_tmp[face_index].unbindFramebuffer();
|
||||
});
|
||||
|
||||
// DRAW DUAL BRUSH
|
||||
|
||||
@@ -248,6 +248,9 @@ struct LegacyCanvasStrokePadExecutionResult {
|
||||
std::size_t padded_faces = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokePadExecutionResult execute_legacy_canvas_stroke_pad_faces(
|
||||
const LegacyCanvasStrokePadExecutionRequest& request);
|
||||
|
||||
struct LegacyCanvasStrokeMixPassPlane {
|
||||
int index = 0;
|
||||
bool visible = true;
|
||||
@@ -368,6 +371,35 @@ std::size_t execute_legacy_canvas_stroke_main_pass_frame_callbacks(
|
||||
pass_dirty_faces);
|
||||
}
|
||||
|
||||
template <typename Faces, typename UploadPadVertices, typename BeginFace, typename BindDestinationTexture, typename CopyFramebufferToDestinationTexture, typename UnbindDestinationTexture, typename DrawPad, typename FinishFace>
|
||||
std::size_t execute_legacy_canvas_stroke_pad_face_callbacks(
|
||||
Faces&& faces,
|
||||
pp::renderer::Extent2D extent,
|
||||
bool copy_stroke_destination,
|
||||
UploadPadVertices&& upload_pad_vertices,
|
||||
BeginFace&& begin_face,
|
||||
BindDestinationTexture&& bind_destination_texture,
|
||||
CopyFramebufferToDestinationTexture&& copy_framebuffer_to_destination_texture,
|
||||
UnbindDestinationTexture&& unbind_destination_texture,
|
||||
DrawPad&& draw_pad,
|
||||
FinishFace&& finish_face)
|
||||
{
|
||||
return execute_legacy_canvas_stroke_pad_faces(
|
||||
LegacyCanvasStrokePadExecutionRequest {
|
||||
.context = "Canvas::stroke_draw",
|
||||
.extent = extent,
|
||||
.faces = std::forward<Faces>(faces),
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.upload_pad_vertices = std::forward<UploadPadVertices>(upload_pad_vertices),
|
||||
.begin_face = std::forward<BeginFace>(begin_face),
|
||||
.bind_destination_texture = std::forward<BindDestinationTexture>(bind_destination_texture),
|
||||
.copy_framebuffer_to_destination_texture = std::forward<CopyFramebufferToDestinationTexture>(copy_framebuffer_to_destination_texture),
|
||||
.unbind_destination_texture = std::forward<UnbindDestinationTexture>(unbind_destination_texture),
|
||||
.draw_pad = std::forward<DrawPad>(draw_pad),
|
||||
.finish_face = std::forward<FinishFace>(finish_face),
|
||||
}).padded_faces;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline LegacyCanvasStrokeDualPassResult execute_legacy_canvas_stroke_dual_pass(
|
||||
const LegacyCanvasStrokeDualPassRequest& request)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user