Extract dual stroke tip dispatch overload
This commit is contained in:
@@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Recent Reductions
|
## Recent Reductions
|
||||||
|
|
||||||
|
- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now
|
||||||
|
routes dual-brush tip dispatch through retained helper overloads, so the
|
||||||
|
face-index callback wiring is no longer built inline in the dual-pass
|
||||||
|
branch.
|
||||||
- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now
|
- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now
|
||||||
routes pad destination texture dispatch through retained helper overloads,
|
routes pad destination texture dispatch through retained helper overloads,
|
||||||
so the face-index callback wiring is no longer built inline in the pad
|
so the face-index callback wiring is no longer built inline in the pad
|
||||||
|
|||||||
@@ -575,6 +575,9 @@ Done Checks:
|
|||||||
|
|
||||||
Progress Notes:
|
Progress Notes:
|
||||||
|
|
||||||
|
- 2026-06-13: `Canvas::stroke_draw()` now routes dual-brush tip dispatch
|
||||||
|
through retained helper overloads, so the face-index callback wiring is no
|
||||||
|
longer built inline in the dual-pass branch.
|
||||||
- 2026-06-13: `Canvas::stroke_draw()` now routes pad destination texture
|
- 2026-06-13: `Canvas::stroke_draw()` now routes pad destination texture
|
||||||
dispatch through retained helper overloads, so the face-index callback
|
dispatch through retained helper overloads, so the face-index callback
|
||||||
wiring is no longer built inline in the pad branch.
|
wiring is no longer built inline in the pad branch.
|
||||||
|
|||||||
@@ -946,16 +946,17 @@ void Canvas::stroke_draw()
|
|||||||
[&](int texture_slot) {
|
[&](int texture_slot) {
|
||||||
set_active_texture_unit(texture_slot);
|
set_active_texture_unit(texture_slot);
|
||||||
},
|
},
|
||||||
[&] {
|
[&](int) {
|
||||||
dual_brush->m_tip_texture ?
|
dual_brush->m_tip_texture ?
|
||||||
dual_brush->m_tip_texture->bind() :
|
dual_brush->m_tip_texture->bind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
},
|
},
|
||||||
[&] {
|
[&](int) {
|
||||||
dual_brush->m_tip_texture ?
|
dual_brush->m_tip_texture ?
|
||||||
dual_brush->m_tip_texture->unbind() :
|
dual_brush->m_tip_texture->unbind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
}));
|
},
|
||||||
|
0));
|
||||||
},
|
},
|
||||||
.unbind_brush_tip = [&] {
|
.unbind_brush_tip = [&] {
|
||||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||||
@@ -964,16 +965,17 @@ void Canvas::stroke_draw()
|
|||||||
[&](int texture_slot) {
|
[&](int texture_slot) {
|
||||||
set_active_texture_unit(texture_slot);
|
set_active_texture_unit(texture_slot);
|
||||||
},
|
},
|
||||||
[&] {
|
[&](int) {
|
||||||
dual_brush->m_tip_texture ?
|
dual_brush->m_tip_texture ?
|
||||||
dual_brush->m_tip_texture->bind() :
|
dual_brush->m_tip_texture->bind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
},
|
},
|
||||||
[&] {
|
[&](int) {
|
||||||
dual_brush->m_tip_texture ?
|
dual_brush->m_tip_texture ?
|
||||||
dual_brush->m_tip_texture->unbind() :
|
dual_brush->m_tip_texture->unbind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
}));
|
},
|
||||||
|
0));
|
||||||
},
|
},
|
||||||
.setup_dual_shader = [&] {
|
.setup_dual_shader = [&] {
|
||||||
pp::panopainter::setup_legacy_stroke_dual_shader(
|
pp::panopainter::setup_legacy_stroke_dual_shader(
|
||||||
|
|||||||
@@ -116,6 +116,22 @@ struct LegacyCanvasStrokeTextureInputDispatch {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_brush_tip_texture_dispatch(
|
||||||
|
std::function<void(int)> activate_texture_unit,
|
||||||
|
std::function<void(int)> bind_brush_tip,
|
||||||
|
std::function<void(int)> unbind_brush_tip,
|
||||||
|
int face_index)
|
||||||
|
{
|
||||||
|
return make_legacy_canvas_stroke_brush_tip_texture_dispatch(
|
||||||
|
std::move(activate_texture_unit),
|
||||||
|
[bind_brush_tip = std::move(bind_brush_tip), face_index]() {
|
||||||
|
bind_brush_tip(face_index);
|
||||||
|
},
|
||||||
|
[unbind_brush_tip = std::move(unbind_brush_tip), face_index]() {
|
||||||
|
unbind_brush_tip(face_index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_destination_texture_dispatch(
|
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_destination_texture_dispatch(
|
||||||
std::function<void(int)> activate_texture_unit,
|
std::function<void(int)> activate_texture_unit,
|
||||||
std::function<void()> bind_stroke_destination,
|
std::function<void()> bind_stroke_destination,
|
||||||
|
|||||||
@@ -309,6 +309,27 @@ void retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_
|
|||||||
PP_EXPECT(h, events == expected_events);
|
PP_EXPECT(h, events == expected_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_face_wiring(pp::tests::Harness& h)
|
||||||
|
{
|
||||||
|
std::vector<std::string> events;
|
||||||
|
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
|
||||||
|
[&](int slot) { events.emplace_back("activate:" + std::to_string(slot)); },
|
||||||
|
[&](int face_index) { events.emplace_back("bind:" + std::to_string(face_index)); },
|
||||||
|
[&](int face_index) { events.emplace_back("unbind:" + std::to_string(face_index)); },
|
||||||
|
2);
|
||||||
|
|
||||||
|
dispatch.activate_texture_unit(0);
|
||||||
|
dispatch.bind_brush_tip();
|
||||||
|
dispatch.unbind_brush_tip();
|
||||||
|
|
||||||
|
const std::vector<std::string> expected_events {
|
||||||
|
"activate:0",
|
||||||
|
"bind:2",
|
||||||
|
"unbind:2",
|
||||||
|
};
|
||||||
|
PP_EXPECT(h, events == expected_events);
|
||||||
|
}
|
||||||
|
|
||||||
void retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
void retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||||
{
|
{
|
||||||
std::vector<std::string> events;
|
std::vector<std::string> events;
|
||||||
@@ -1818,6 +1839,9 @@ int main()
|
|||||||
harness.run(
|
harness.run(
|
||||||
"retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring",
|
"retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||||
retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring);
|
retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||||
|
harness.run(
|
||||||
|
"retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_face_wiring",
|
||||||
|
retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_face_wiring);
|
||||||
harness.run(
|
harness.run(
|
||||||
"retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring",
|
"retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||||
retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring);
|
retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||||
|
|||||||
Reference in New Issue
Block a user