Extract stroke draw pad face orchestration
This commit is contained in:
@@ -876,6 +876,46 @@ void Canvas::stroke_draw_pad_pass(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::stroke_draw_pad_face_orchestration(
|
||||||
|
const std::array<bool, 6>& box_dirty,
|
||||||
|
const std::array<glm::vec4, 6>& box_face,
|
||||||
|
bool copy_stroke_destination,
|
||||||
|
const pp::renderer::Extent2D& stroke_extent,
|
||||||
|
const glm::vec4& pad_color)
|
||||||
|
{
|
||||||
|
pp::panopainter::setup_legacy_stroke_pad_shader(
|
||||||
|
pp::panopainter::LegacyStrokePadUniforms {
|
||||||
|
.color = pad_color,
|
||||||
|
.uses_destination_feedback = copy_stroke_destination,
|
||||||
|
});
|
||||||
|
const auto pad_faces = pp::panopainter::make_legacy_canvas_stroke_pad_faces(box_dirty, box_face);
|
||||||
|
constexpr std::array pad_destination_texture_binding {
|
||||||
|
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
||||||
|
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
|
||||||
|
.slot = 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const auto pad_destination_texture_dispatch =
|
||||||
|
pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
||||||
|
[&](int texture_slot) {
|
||||||
|
set_active_texture_unit(texture_slot);
|
||||||
|
},
|
||||||
|
[&](int dst_face_index) {
|
||||||
|
m_tex[dst_face_index].bind();
|
||||||
|
},
|
||||||
|
[&](int dst_face_index) {
|
||||||
|
m_tex[dst_face_index].unbind();
|
||||||
|
},
|
||||||
|
0);
|
||||||
|
stroke_draw_pad_pass(
|
||||||
|
pad_faces,
|
||||||
|
copy_stroke_destination,
|
||||||
|
pad_destination_texture_binding,
|
||||||
|
pad_destination_texture_dispatch,
|
||||||
|
stroke_extent,
|
||||||
|
pad_color);
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::stroke_draw_dual_pass(
|
void Canvas::stroke_draw_dual_pass(
|
||||||
const std::vector<StrokeFrame>& frames_dual,
|
const std::vector<StrokeFrame>& frames_dual,
|
||||||
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
||||||
@@ -1172,35 +1212,10 @@ void Canvas::stroke_draw()
|
|||||||
// NOTE: at the moment this works on the whole canvas, but it can be optimized
|
// NOTE: at the moment this works on the whole canvas, but it can be optimized
|
||||||
// to only affect the current dirty box. In this case it may be necessary to do this
|
// to only affect the current dirty box. In this case it may be necessary to do this
|
||||||
// work on documents that doesn't have the padding, so on document loading.
|
// work on documents that doesn't have the padding, so on document loading.
|
||||||
pp::panopainter::setup_legacy_stroke_pad_shader(
|
stroke_draw_pad_face_orchestration(
|
||||||
pp::panopainter::LegacyStrokePadUniforms {
|
box_dirty,
|
||||||
.color = pad_color,
|
box_face,
|
||||||
.uses_destination_feedback = copy_stroke_destination,
|
|
||||||
});
|
|
||||||
const auto pad_faces = pp::panopainter::make_legacy_canvas_stroke_pad_faces(box_dirty, box_face);
|
|
||||||
constexpr std::array pad_destination_texture_binding {
|
|
||||||
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
|
||||||
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
|
|
||||||
.slot = 1,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const auto pad_destination_texture_dispatch =
|
|
||||||
pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
|
||||||
[&](int texture_slot) {
|
|
||||||
set_active_texture_unit(texture_slot);
|
|
||||||
},
|
|
||||||
[&](int dst_face_index) {
|
|
||||||
m_tex[dst_face_index].bind();
|
|
||||||
},
|
|
||||||
[&](int dst_face_index) {
|
|
||||||
m_tex[dst_face_index].unbind();
|
|
||||||
},
|
|
||||||
0);
|
|
||||||
stroke_draw_pad_pass(
|
|
||||||
pad_faces,
|
|
||||||
copy_stroke_destination,
|
copy_stroke_destination,
|
||||||
pad_destination_texture_binding,
|
|
||||||
pad_destination_texture_dispatch,
|
|
||||||
stroke_extent,
|
stroke_extent,
|
||||||
pad_color);
|
pad_color);
|
||||||
|
|
||||||
|
|||||||
@@ -247,6 +247,12 @@ private:
|
|||||||
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch& pad_destination_texture_dispatch,
|
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch& pad_destination_texture_dispatch,
|
||||||
const pp::renderer::Extent2D& stroke_extent,
|
const pp::renderer::Extent2D& stroke_extent,
|
||||||
const glm::vec4& pad_color);
|
const glm::vec4& pad_color);
|
||||||
|
void stroke_draw_pad_face_orchestration(
|
||||||
|
const std::array<bool, 6>& box_dirty,
|
||||||
|
const std::array<glm::vec4, 6>& box_face,
|
||||||
|
bool copy_stroke_destination,
|
||||||
|
const pp::renderer::Extent2D& stroke_extent,
|
||||||
|
const glm::vec4& pad_color);
|
||||||
void stroke_draw_dual_pass(
|
void stroke_draw_dual_pass(
|
||||||
const std::vector<StrokeFrame>& frames_dual,
|
const std::vector<StrokeFrame>& frames_dual,
|
||||||
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,
|
||||||
|
|||||||
Reference in New Issue
Block a user