Extract dual brush tip dispatch

This commit is contained in:
2026-06-13 23:04:26 +02:00
parent 92c830ed64
commit 065ddf8ebc
4 changed files with 73 additions and 30 deletions

View File

@@ -537,6 +537,10 @@ agent or engineer to remove them without reconstructing context from chat.
sampler dispatch now has regression coverage through sampler dispatch now has regression coverage through
`make_legacy_canvas_stroke_live_pass_sampler_dispatch(...)`; the live path `make_legacy_canvas_stroke_live_pass_sampler_dispatch(...)`; the live path
still owns the concrete sampler objects and binding state. still owns the concrete sampler objects and binding state.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw()` dual-pass
brush-tip dispatch now uses a retained helper object, with regression
coverage proving the helper order; the live path still owns the concrete
brush-tip texture object and dual-pass branch wiring.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge` checkerboard - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge` checkerboard
background shader setup and final merged-texture redraw setup now route background shader setup and final merged-texture redraw setup now route
through `legacy_canvas_draw_merge_services.h`. The retained Canvas path still through `legacy_canvas_draw_merge_services.h`. The retained Canvas path still

View File

@@ -668,6 +668,12 @@ Validation:
ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure
``` ```
### Completed Task Log
| Date | Task | Score | Validation | Commit |
| --- | --- | --- | --- | --- |
| 2026-06-13 | STR-022 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure` | `pending` |
Progress Notes: Progress Notes:
- 2026-06-13: `NodeStrokePreview::draw_stroke_immediate()` now routes final - 2026-06-13: `NodeStrokePreview::draw_stroke_immediate()` now routes final

View File

@@ -1121,6 +1121,22 @@ void Canvas::stroke_draw()
.slot = 0, .slot = 0,
}, },
}; };
const auto dual_pass_brush_tip_dispatch =
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
0);
auto frames_dual = stroke_draw_compute(*m_dual_stroke); auto frames_dual = stroke_draw_compute(*m_dual_stroke);
const std::array<bool, 6> include_dual_dirty = const std::array<bool, 6> include_dual_dirty =
SIXPLETTE(stroke_material.composite_pass.dual_blend_mode == 0); SIXPLETTE(stroke_material.composite_pass.dual_blend_mode == 0);
@@ -1131,40 +1147,12 @@ void Canvas::stroke_draw()
.bind_brush_tip = [&] { .bind_brush_tip = [&] {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
dual_pass_texture_bindings, dual_pass_texture_bindings,
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch( dual_pass_brush_tip_dispatch);
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
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(
dual_pass_texture_bindings, dual_pass_texture_bindings,
pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch( dual_pass_brush_tip_dispatch);
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->bind() :
unbind_texture_2d();
},
[&](int) {
dual_brush->m_tip_texture ?
dual_brush->m_tip_texture->unbind() :
unbind_texture_2d();
},
0));
}, },
.setup_dual_shader = [&] { .setup_dual_shader = [&] {
pp::panopainter::setup_legacy_stroke_dual_shader( pp::panopainter::setup_legacy_stroke_dual_shader(

View File

@@ -1892,6 +1892,48 @@ void legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order(pp::tests::
PP_EXPECT(h, steps == expected); PP_EXPECT(h, steps == expected);
} }
void legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order(pp::tests::Harness& h)
{
std::vector<std::string> steps;
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
[&](int slot) {
steps.emplace_back("activate:" + std::to_string(slot));
},
[&](int) {
steps.emplace_back("bind-tip");
},
[&](int) {
steps.emplace_back("unbind-tip");
},
0);
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
.slot = 0,
},
},
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
.slot = 0,
},
},
dispatch);
const std::vector<std::string> expected {
"activate:0",
"bind-tip",
"activate:0",
"unbind-tip",
};
PP_EXPECT(h, steps == expected);
}
void plans_canvas_stroke_commit_erase_sequence(pp::tests::Harness& h) void plans_canvas_stroke_commit_erase_sequence(pp::tests::Harness& h)
{ {
const auto plan = plan_canvas_stroke_commit_sequence( const auto plan = plan_canvas_stroke_commit_sequence(
@@ -3767,6 +3809,9 @@ int main()
harness.run( harness.run(
"legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order", "legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order",
legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order); legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order);
harness.run(
"legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order",
legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order);
harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence); harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence);
harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence); harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence);
harness.run( harness.run(