Extract dual brush tip dispatch

This commit is contained in:
2026-06-13 23:04:26 +02:00
parent 92c830ed64
commit 065ddf8ebc
4 changed files with 73 additions and 30 deletions

View File

@@ -1121,6 +1121,22 @@ void Canvas::stroke_draw()
.slot = 0,
},
};
const auto dual_pass_brush_tip_dispatch =
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
0);
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);
@@ -1131,40 +1147,12 @@ void Canvas::stroke_draw()
.bind_brush_tip = [&] {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
dual_pass_texture_bindings,
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
0));
dual_pass_brush_tip_dispatch);
},
.unbind_brush_tip = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
dual_pass_texture_bindings,
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
0));
dual_pass_brush_tip_dispatch);
},
.setup_dual_shader = [&] {
pp::panopainter::setup_legacy_stroke_dual_shader(