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

@@ -630,7 +630,6 @@ void Canvas::stroke_draw()
const auto cc = query_canvas_clear_color();
const auto& brush = m_current_stroke->m_brush;
const auto& dual_brush = m_dual_stroke->m_brush;
auto ortho_proj = glm::ortho(0.f, (float)m_width, 0.f, (float)m_height, -1.f, 1.f);
apply_canvas_viewport(0, 0, m_width, m_height);
@@ -690,7 +689,7 @@ void Canvas::stroke_draw()
std::array<bool, 6> box_dirty = SIXPLETTE(false);
const std::array<bool, 6> include_main_dirty = SIXPLETTE(true);
glm::vec4 pad_color;
pp::panopainter::execute_legacy_canvas_stroke_frame_samples_with_dirty_tracking(
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_dirty_tracking(
frames,
stroke_extent,
std::span<glm::vec4>(m_dirty_box),
@@ -718,7 +717,6 @@ void Canvas::stroke_draw()
});
return stroke_draw_samples(i, P, copy_stroke_destination);
},
[&](auto&, int, auto&, auto&) {},
[&](auto&, int i, auto&, glm::vec4) {
m_tmp[i].unbindFramebuffer();
});
@@ -792,8 +790,9 @@ void Canvas::stroke_draw()
// DRAW DUAL BRUSH
if (stroke_material.dual_pass.enabled)
if (stroke_material.dual_pass.enabled && m_dual_stroke)
{
const auto& dual_brush = m_dual_stroke->m_brush;
pp::panopainter::setup_legacy_stroke_dual_shader(stroke_material.dual_pass.uses_pattern);
set_active_texture_unit(0);
@@ -803,7 +802,7 @@ void Canvas::stroke_draw()
auto frames_dual = stroke_draw_compute(*m_dual_stroke);
const std::array<bool, 6> include_dual_dirty =
SIXPLETTE(stroke_material.composite_pass.dual_blend_mode == 0);
pp::panopainter::execute_legacy_canvas_stroke_frame_samples_with_dirty_tracking(
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_dirty_tracking(
frames_dual,
stroke_extent,
std::span<glm::vec4>(m_dirty_box),
@@ -823,12 +822,15 @@ void Canvas::stroke_draw()
[&](auto&, int i, auto& P) {
return stroke_draw_samples(i, P, copy_stroke_destination);
},
[&](auto&, int, auto&, auto& request) {
request.previous_pass_dirty_box = request.sample_dirty_box;
},
[&](auto&, int i, auto&, glm::vec4) {
m_tmp_dual[i].unbindFramebuffer();
});
},
true);
set_active_texture_unit(0);
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
}
m_sampler_brush.unbind();