Add live pass sampler dispatch helper coverage
This commit is contained in:
@@ -509,6 +509,10 @@ Done Checks:
|
|||||||
|
|
||||||
Progress Notes:
|
Progress Notes:
|
||||||
|
|
||||||
|
- 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`
|
||||||
|
should now focus only on the last tiny binding leftovers or be marked done
|
||||||
|
once the debt note is updated.
|
||||||
- 2026-06-13: `STR-004` is now the next ready slice for the last inline stroke
|
- 2026-06-13: `STR-004` is now the next ready slice for the last inline stroke
|
||||||
dispatch glue; `LATER-003` is effectively at the binding-only tail. Keep
|
dispatch glue; `LATER-003` is effectively at the binding-only tail. Keep
|
||||||
this task focused on removing or consolidating helper-builder wiring rather
|
this task focused on removing or consolidating helper-builder wiring rather
|
||||||
|
|||||||
@@ -732,7 +732,7 @@ void Canvas::stroke_draw()
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const pp::panopainter::LegacyCanvasStrokeSamplerDispatch live_pass_sampler_dispatch =
|
const pp::panopainter::LegacyCanvasStrokeSamplerDispatch live_pass_sampler_dispatch =
|
||||||
pp::panopainter::make_legacy_canvas_stroke_sampler_dispatch(
|
pp::panopainter::make_legacy_canvas_stroke_live_pass_sampler_dispatch(
|
||||||
[&](int slot) {
|
[&](int slot) {
|
||||||
m_sampler_brush.bind(slot);
|
m_sampler_brush.bind(slot);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -127,6 +127,28 @@ struct LegacyCanvasStrokeSamplerDispatch {
|
|||||||
std::function<void()> unbind_mixer_sampler;
|
std::function<void()> unbind_mixer_sampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[[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,
|
||||||
|
std::function<void(int)> bind_stroke_destination_sampler,
|
||||||
|
std::function<void()> unbind_stroke_destination_sampler,
|
||||||
|
std::function<void(int)> bind_pattern_sampler,
|
||||||
|
std::function<void()> unbind_pattern_sampler,
|
||||||
|
std::function<void(int)> bind_mixer_sampler,
|
||||||
|
std::function<void()> unbind_mixer_sampler)
|
||||||
|
{
|
||||||
|
return LegacyCanvasStrokeSamplerDispatch {
|
||||||
|
.bind_brush_tip_sampler = std::move(bind_brush_tip_sampler),
|
||||||
|
.unbind_brush_tip_sampler = std::move(unbind_brush_tip_sampler),
|
||||||
|
.bind_stroke_destination_sampler = std::move(bind_stroke_destination_sampler),
|
||||||
|
.unbind_stroke_destination_sampler = std::move(unbind_stroke_destination_sampler),
|
||||||
|
.bind_pattern_sampler = std::move(bind_pattern_sampler),
|
||||||
|
.unbind_pattern_sampler = std::move(unbind_pattern_sampler),
|
||||||
|
.bind_mixer_sampler = std::move(bind_mixer_sampler),
|
||||||
|
.unbind_mixer_sampler = std::move(unbind_mixer_sampler),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline LegacyCanvasStrokeSamplerDispatch make_legacy_canvas_stroke_sampler_dispatch(
|
[[nodiscard]] inline LegacyCanvasStrokeSamplerDispatch make_legacy_canvas_stroke_sampler_dispatch(
|
||||||
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,
|
||||||
|
|||||||
@@ -287,6 +287,34 @@ void retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_
|
|||||||
PP_EXPECT(h, events == expected_events);
|
PP_EXPECT(h, events == expected_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||||
|
{
|
||||||
|
std::vector<std::string> events;
|
||||||
|
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_live_pass_sampler_dispatch(
|
||||||
|
[&](int slot) { events.emplace_back("bind:brush_tip:" + std::to_string(slot)); },
|
||||||
|
[&] { events.emplace_back("unbind:brush_tip"); },
|
||||||
|
[&](int slot) { events.emplace_back("bind:destination:" + std::to_string(slot)); },
|
||||||
|
[&] { events.emplace_back("unbind:destination"); },
|
||||||
|
[&](int slot) { events.emplace_back("bind:pattern:" + std::to_string(slot)); },
|
||||||
|
[&] { events.emplace_back("unbind:pattern"); },
|
||||||
|
[&](int slot) { events.emplace_back("bind:mixer:" + std::to_string(slot)); },
|
||||||
|
[&] { events.emplace_back("unbind:mixer"); });
|
||||||
|
|
||||||
|
pp::panopainter::bind_legacy_canvas_stroke_sampler_input(
|
||||||
|
LegacyCanvasStrokeTextureInput::brush_tip,
|
||||||
|
4,
|
||||||
|
dispatch);
|
||||||
|
pp::panopainter::unbind_legacy_canvas_stroke_sampler_input(
|
||||||
|
LegacyCanvasStrokeTextureInput::brush_tip,
|
||||||
|
dispatch);
|
||||||
|
|
||||||
|
const std::vector<std::string> expected_events {
|
||||||
|
"bind:brush_tip:4",
|
||||||
|
"unbind:brush_tip",
|
||||||
|
};
|
||||||
|
PP_EXPECT(h, events == expected_events);
|
||||||
|
}
|
||||||
|
|
||||||
void retained_stroke_sample_executor_copies_destination_and_expands_quads(pp::tests::Harness& h)
|
void retained_stroke_sample_executor_copies_destination_and_expands_quads(pp::tests::Harness& h)
|
||||||
{
|
{
|
||||||
const auto vertices = make_quad_vertices();
|
const auto vertices = make_quad_vertices();
|
||||||
@@ -1370,6 +1398,9 @@ int main()
|
|||||||
harness.run(
|
harness.run(
|
||||||
"retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring",
|
"retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||||
retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring);
|
retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||||
|
harness.run(
|
||||||
|
"retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring",
|
||||||
|
retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring);
|
||||||
harness.run(
|
harness.run(
|
||||||
"retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty",
|
"retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty",
|
||||||
retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty);
|
retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty);
|
||||||
|
|||||||
Reference in New Issue
Block a user