Extract pad destination 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 pad destination texture dispatch through retained helper overloads,
|
||||||
|
so the face-index callback wiring is no longer built inline in the pad
|
||||||
|
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 its main live-pass bind, execute, and unbind sequence through
|
routes its main live-pass bind, execute, and unbind sequence through
|
||||||
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
|
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
|
||||||
|
|||||||
@@ -575,6 +575,9 @@ Done Checks:
|
|||||||
|
|
||||||
Progress Notes:
|
Progress Notes:
|
||||||
|
|
||||||
|
- 2026-06-13: `Canvas::stroke_draw()` now routes pad destination texture
|
||||||
|
dispatch through retained helper overloads, so the face-index callback
|
||||||
|
wiring is no longer built inline in the pad branch.
|
||||||
- 2026-06-13: `Canvas::stroke_draw()` now routes its main live-pass bind,
|
- 2026-06-13: `Canvas::stroke_draw()` now routes its main live-pass bind,
|
||||||
execute, and unbind sequence through
|
execute, and unbind sequence through
|
||||||
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
|
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
|
||||||
|
|||||||
@@ -863,18 +863,6 @@ void Canvas::stroke_draw()
|
|||||||
.slot = 1,
|
.slot = 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const auto make_pad_destination_texture_dispatch = [&](int face_index) {
|
|
||||||
return pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
|
||||||
[&](int texture_slot) {
|
|
||||||
set_active_texture_unit(texture_slot);
|
|
||||||
},
|
|
||||||
[&] {
|
|
||||||
m_tex[face_index].bind();
|
|
||||||
},
|
|
||||||
[&] {
|
|
||||||
m_tex[face_index].unbind();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
[[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_face_callbacks(
|
[[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_face_callbacks(
|
||||||
pad_faces,
|
pad_faces,
|
||||||
stroke_extent,
|
stroke_extent,
|
||||||
@@ -890,7 +878,17 @@ void Canvas::stroke_draw()
|
|||||||
[&](int face_index) {
|
[&](int face_index) {
|
||||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||||
pad_destination_texture_binding,
|
pad_destination_texture_binding,
|
||||||
make_pad_destination_texture_dispatch(face_index));
|
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();
|
||||||
|
},
|
||||||
|
face_index));
|
||||||
},
|
},
|
||||||
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
|
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
|
||||||
copy_framebuffer_to_texture_2d(
|
copy_framebuffer_to_texture_2d(
|
||||||
@@ -904,7 +902,17 @@ void Canvas::stroke_draw()
|
|||||||
[&](int face_index) {
|
[&](int face_index) {
|
||||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||||
pad_destination_texture_binding,
|
pad_destination_texture_binding,
|
||||||
make_pad_destination_texture_dispatch(face_index));
|
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();
|
||||||
|
},
|
||||||
|
face_index));
|
||||||
},
|
},
|
||||||
[&] {
|
[&] {
|
||||||
m_brush_shape.draw_fill();
|
m_brush_shape.draw_fill();
|
||||||
|
|||||||
@@ -140,6 +140,22 @@ struct LegacyCanvasStrokeTextureInputDispatch {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
||||||
|
std::function<void(int)> activate_texture_unit,
|
||||||
|
std::function<void(int)> bind_stroke_destination,
|
||||||
|
std::function<void(int)> unbind_stroke_destination,
|
||||||
|
int face_index)
|
||||||
|
{
|
||||||
|
return make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
||||||
|
std::move(activate_texture_unit),
|
||||||
|
[bind_stroke_destination = std::move(bind_stroke_destination), face_index]() {
|
||||||
|
bind_stroke_destination(face_index);
|
||||||
|
},
|
||||||
|
[unbind_stroke_destination = std::move(unbind_stroke_destination), face_index]() {
|
||||||
|
unbind_stroke_destination(face_index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
struct LegacyCanvasStrokeSamplerDispatch {
|
struct LegacyCanvasStrokeSamplerDispatch {
|
||||||
std::function<void(int)> bind_brush_tip_sampler;
|
std::function<void(int)> bind_brush_tip_sampler;
|
||||||
std::function<void()> unbind_brush_tip_sampler;
|
std::function<void()> unbind_brush_tip_sampler;
|
||||||
|
|||||||
@@ -361,6 +361,27 @@ void retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_cal
|
|||||||
PP_EXPECT(h, events == expected_events);
|
PP_EXPECT(h, events == expected_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void retained_stroke_pad_destination_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_pad_destination_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)); },
|
||||||
|
4);
|
||||||
|
|
||||||
|
dispatch.activate_texture_unit(1);
|
||||||
|
dispatch.bind_stroke_destination();
|
||||||
|
dispatch.unbind_stroke_destination();
|
||||||
|
|
||||||
|
const std::vector<std::string> expected_events {
|
||||||
|
"activate:1",
|
||||||
|
"bind:4",
|
||||||
|
"unbind:4",
|
||||||
|
};
|
||||||
|
PP_EXPECT(h, events == expected_events);
|
||||||
|
}
|
||||||
|
|
||||||
void retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
void retained_stroke_destination_texture_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||||
{
|
{
|
||||||
std::vector<std::string> events;
|
std::vector<std::string> events;
|
||||||
@@ -1791,6 +1812,9 @@ int main()
|
|||||||
harness.run(
|
harness.run(
|
||||||
"retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring",
|
"retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||||
retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring);
|
retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||||
|
harness.run(
|
||||||
|
"retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_face_wiring",
|
||||||
|
retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_face_wiring);
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user