Reuse stroke brush tip dispatch helper

This commit is contained in:
2026-06-13 16:51:27 +02:00
parent 5891d2839d
commit 2a29ebb1a9
3 changed files with 34 additions and 15 deletions

View File

@@ -509,12 +509,11 @@ Done Checks:
Progress Notes:
- 2026-06-13: `Canvas::stroke_draw()` dual-brush replay now routes shader
setup, brush-tip texture binding, live-pass execution, and brush-tip
unbinding through `execute_legacy_canvas_stroke_dual_pass(...)`; the live
adapter still owns the concrete texture callbacks and face-frame replay.
Next slice should target another narrow `stroke_draw()` seam without
reopening landed pad or sample helpers.
- 2026-06-13: `Canvas::stroke_draw()` dual-brush replay now reuses the new
retained brush-tip texture dispatch helper for binding and unbinding; the
live adapter still owns the concrete brush texture object and live-pass
execution. Next slice should target another narrow `stroke_draw()` seam
without reopening landed pad or sample helpers.
- 2026-06-13: `Canvas::stroke_draw()` dual-brush replay now routes shader
setup, brush-tip texture binding, live-pass execution, and brush-tip
unbinding through `execute_legacy_canvas_stroke_dual_pass(...)`; the live

View File

@@ -926,16 +926,20 @@ void Canvas::stroke_draw()
.bind_brush_tip = [&] {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
dual_pass_texture_bindings,
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
.activate_texture_unit = [&](int texture_slot) {
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
.bind_brush_tip = [&] {
[&] {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
});
[&] {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
}));
},
.execute_frame_pass = [&] {
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
@@ -962,16 +966,20 @@ void Canvas::stroke_draw()
.unbind_brush_tip = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
dual_pass_texture_bindings,
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
.activate_texture_unit = [&](int texture_slot) {
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
.unbind_brush_tip = [&] {
[&] {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&] {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
});
}));
},
});
}

View File

@@ -86,6 +86,18 @@ struct LegacyCanvasStrokeTextureInputDispatch {
std::function<void()> unbind_mixer;
};
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_brush_tip_texture_dispatch(
std::function<void(int)> activate_texture_unit,
std::function<void()> bind_brush_tip,
std::function<void()> unbind_brush_tip)
{
return LegacyCanvasStrokeTextureInputDispatch {
.activate_texture_unit = std::move(activate_texture_unit),
.bind_brush_tip = std::move(bind_brush_tip),
.unbind_brush_tip = std::move(unbind_brush_tip),
};
}
struct LegacyCanvasStrokeSamplerDispatch {
std::function<void(int)> bind_brush_tip_sampler;
std::function<void()> unbind_brush_tip_sampler;