Extract stroke mix setup shell

This commit is contained in:
2026-06-13 19:17:36 +02:00
parent defb1af0d9
commit 55fb02e472
5 changed files with 51 additions and 5 deletions

View File

@@ -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_mix()` now
routes the setup/end shell through
`make_legacy_canvas_stroke_mix_pass_setup(...)`; the live path still owns
the concrete framebuffer bind and GL capability toggles.
- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw_mix()` now - 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw_mix()` now
routes its retained mix-pass execution shell through routes its retained mix-pass execution shell through
`execute_legacy_canvas_stroke_mix_pass_with_setup(...)` with a concrete `execute_legacy_canvas_stroke_mix_pass_with_setup(...)` with a concrete

View File

@@ -595,6 +595,9 @@ Progress Notes:
execution shell through `execute_legacy_canvas_stroke_mix_pass_with_setup(...)` execution shell through `execute_legacy_canvas_stroke_mix_pass_with_setup(...)`
with a concrete request builder; the live path still owns the OpenGL setup with a concrete request builder; the live path still owns the OpenGL setup
and per-plane texture wiring. and per-plane texture wiring.
- 2026-06-13: `Canvas::stroke_draw_mix()` now routes the setup/end shell through
`make_legacy_canvas_stroke_mix_pass_setup(...)`; the live path still owns the
concrete framebuffer bind and GL capability toggles.
- 2026-06-13: `Canvas::stroke_draw()` live-pass sampler wiring now reuses a - 2026-06-13: `Canvas::stroke_draw()` live-pass sampler wiring now reuses a
retained helper builder, and the stroke execution tests cover it. `STR-004` retained helper builder, and the stroke execution tests cover it. `STR-004`
is now done after the final pad-destination helper extraction and tracker is now done after the final pad-destination helper extraction and tracker

View File

@@ -403,9 +403,8 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
return current_layer.face(plane_index); return current_layer.face(plane_index);
}); });
const auto& b = m_current_stroke->m_brush; const auto& b = m_current_stroke->m_brush;
[[maybe_unused]] const auto mix_result = const auto mix_setup = pp::panopainter::make_legacy_canvas_stroke_mix_pass_setup(
pp::panopainter::execute_legacy_canvas_stroke_mix_pass_with_setup( [&] {
[&] {
m_mixer.bindFramebuffer(); m_mixer.bindFramebuffer();
apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight()); apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight());
apply_canvas_capability(depth_test_state(), false); apply_canvas_capability(depth_test_state(), false);
@@ -417,9 +416,13 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
static_cast<std::int32_t>(bb_sz.x), static_cast<std::int32_t>(bb_sz.x),
static_cast<std::int32_t>(bb_sz.y)); static_cast<std::int32_t>(bb_sz.y));
}, },
[&] { [&] {
m_mixer.unbindFramebuffer(); m_mixer.unbindFramebuffer();
}, });
[[maybe_unused]] const auto mix_result =
pp::panopainter::execute_legacy_canvas_stroke_mix_pass_with_setup(
mix_setup.begin,
mix_setup.end,
pp::panopainter::make_legacy_canvas_stroke_mix_pass_request( pp::panopainter::make_legacy_canvas_stroke_mix_pass_request(
"Canvas::stroke_draw_mix", "Canvas::stroke_draw_mix",
m_size, m_size,

View File

@@ -340,6 +340,21 @@ struct LegacyCanvasStrokeMixPassResult {
std::size_t composed_planes = 0; std::size_t composed_planes = 0;
}; };
struct LegacyCanvasStrokeMixPassSetup {
std::function<void()> begin;
std::function<void()> end;
};
[[nodiscard]] inline LegacyCanvasStrokeMixPassSetup make_legacy_canvas_stroke_mix_pass_setup(
std::function<void()> begin,
std::function<void()> end)
{
return LegacyCanvasStrokeMixPassSetup {
.begin = std::move(begin),
.end = std::move(end),
};
}
[[nodiscard]] inline LegacyCanvasStrokeMixPassRequest make_legacy_canvas_stroke_mix_pass_request( [[nodiscard]] inline LegacyCanvasStrokeMixPassRequest make_legacy_canvas_stroke_mix_pass_request(
std::string_view context, std::string_view context,
glm::vec2 resolution, glm::vec2 resolution,

View File

@@ -1885,6 +1885,24 @@ void retained_stroke_mix_pass_request_builder_preserves_callback_wiring(pp::test
PP_EXPECT(h, events == expected_events); PP_EXPECT(h, events == expected_events);
} }
void retained_stroke_mix_pass_setup_builder_preserves_boundaries(pp::tests::Harness& h)
{
std::vector<std::string> events;
const auto setup = pp::panopainter::make_legacy_canvas_stroke_mix_pass_setup(
[&] { events.emplace_back("begin"); },
[&] { events.emplace_back("end"); });
PP_EXPECT(h, setup.begin);
PP_EXPECT(h, setup.end);
setup.begin();
setup.end();
PP_EXPECT(h, events.size() == 2U);
PP_EXPECT(h, events[0] == "begin");
PP_EXPECT(h, events[1] == "end");
}
} // namespace } // namespace
int main() int main()
@@ -1992,5 +2010,8 @@ int main()
harness.run( harness.run(
"retained_stroke_mix_pass_request_builder_preserves_callback_wiring", "retained_stroke_mix_pass_request_builder_preserves_callback_wiring",
retained_stroke_mix_pass_request_builder_preserves_callback_wiring); retained_stroke_mix_pass_request_builder_preserves_callback_wiring);
harness.run(
"retained_stroke_mix_pass_setup_builder_preserves_boundaries",
retained_stroke_mix_pass_setup_builder_preserves_boundaries);
return harness.finish(); return harness.finish();
} }