Extract main stroke live-pass orchestration

This commit is contained in:
2026-06-13 18:44:36 +02:00
parent 93a5d1ac07
commit 58885187ba
5 changed files with 119 additions and 39 deletions

View File

@@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions
- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now
routes its main live-pass bind, execute, and unbind sequence through
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
owns the concrete sampler and texture callbacks.
- 2026-06-13: RND-005 was completed. `desktop-gpu` now has a second
deterministic OpenGL readback fixture and the CTest registration uses the
configured target path so the gate actually runs.

View File

@@ -575,6 +575,10 @@ Done Checks:
Progress Notes:
- 2026-06-13: `Canvas::stroke_draw()` now routes its main live-pass bind,
execute, and unbind sequence through
`execute_legacy_canvas_stroke_main_pass(...)`; the retained adapter still
owns the concrete sampler and texture callbacks.
- 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`
is now done after the final pad-destination helper extraction and tracker

View File

@@ -780,19 +780,27 @@ void Canvas::stroke_draw()
[&] {
m_mixer.unbindTexture();
});
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_bindings,
main_pass_texture_dispatch);
auto frames = stroke_draw_compute(*m_current_stroke);
std::array<glm::vec4, 6> box_face = SIXPLETTE(glm::vec4(m_size, 0, 0));
std::array<bool, 6> box_dirty = SIXPLETTE(false);
const std::array<bool, 6> include_main_dirty = SIXPLETTE(true);
glm::vec4 pad_color;
[[maybe_unused]] const auto main_pass_result =
pp::panopainter::execute_legacy_canvas_stroke_main_pass(
pp::panopainter::LegacyCanvasStrokeMainPassExecutionRequest {
.context = "Canvas::stroke_draw",
.bind_samplers = [&] {
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
},
.bind_textures = [&] {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_bindings,
main_pass_texture_dispatch);
},
.execute_frame_pass = [&] {
pp::panopainter::execute_legacy_canvas_stroke_main_pass_frame_callbacks(
frames,
stroke_extent,
@@ -821,10 +829,18 @@ void Canvas::stroke_draw()
return stroke_draw_samples(i, P, copy_stroke_destination);
},
m_tmp);
},
.unbind_textures = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_unbindings,
main_pass_texture_dispatch);
},
.unbind_samplers = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
},
});
// pad stroke
// In order to mitigate color bleeding at the edge of shapes in transparent layers

View File

@@ -151,6 +151,15 @@ struct LegacyCanvasStrokeSamplerDispatch {
std::function<void()> unbind_mixer_sampler;
};
struct LegacyCanvasStrokeMainPassExecutionRequest {
std::string_view context;
std::function<void()> bind_samplers;
std::function<void()> bind_textures;
std::function<void()> execute_frame_pass;
std::function<void()> unbind_textures;
std::function<void()> unbind_samplers;
};
[[nodiscard]] inline LegacyCanvasStrokeSamplerDispatch make_legacy_canvas_stroke_live_pass_sampler_dispatch(
std::function<void(int)> bind_brush_tip_sampler,
std::function<void()> unbind_brush_tip_sampler,
@@ -195,6 +204,25 @@ struct LegacyCanvasStrokeSamplerDispatch {
};
}
[[nodiscard]] inline bool execute_legacy_canvas_stroke_main_pass(
const LegacyCanvasStrokeMainPassExecutionRequest& request)
{
if (!request.bind_samplers ||
!request.bind_textures ||
!request.execute_frame_pass ||
!request.unbind_textures ||
!request.unbind_samplers) {
return false;
}
request.bind_samplers();
request.bind_textures();
request.execute_frame_pass();
request.unbind_textures();
request.unbind_samplers();
return true;
}
struct LegacyCanvasStrokeFaceDirtyRequest {
pp::renderer::Extent2D extent {};
glm::vec4 previous_accumulated_dirty_box {};

View File

@@ -1437,6 +1437,31 @@ void retained_stroke_main_pass_frame_callbacks_preserve_order(pp::tests::Harness
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_main_pass_execution_preserves_bind_and_unbind_order(pp::tests::Harness& h)
{
std::vector<std::string> events;
const auto ok = pp::panopainter::execute_legacy_canvas_stroke_main_pass(
pp::panopainter::LegacyCanvasStrokeMainPassExecutionRequest {
.context = "test",
.bind_samplers = [&] { events.emplace_back("bind-samplers"); },
.bind_textures = [&] { events.emplace_back("bind-textures"); },
.execute_frame_pass = [&] { events.emplace_back("execute"); },
.unbind_textures = [&] { events.emplace_back("unbind-textures"); },
.unbind_samplers = [&] { events.emplace_back("unbind-samplers"); },
});
const std::vector<std::string> expected_events {
"bind-samplers",
"bind-textures",
"execute",
"unbind-textures",
"unbind-samplers",
};
PP_EXPECT(h, ok);
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_pad_face_callbacks_preserve_order(pp::tests::Harness& h)
{
const std::array<bool, 3> dirty_faces { true, false, true };
@@ -1781,6 +1806,9 @@ int main()
harness.run(
"retained_stroke_main_pass_frame_callbacks_preserve_order",
retained_stroke_main_pass_frame_callbacks_preserve_order);
harness.run(
"retained_stroke_main_pass_execution_preserves_bind_and_unbind_order",
retained_stroke_main_pass_execution_preserves_bind_and_unbind_order);
harness.run(
"retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring);