Share retained erase temporary composite helper

This commit is contained in:
2026-06-13 11:17:16 +02:00
parent dc2d678dac
commit 51458ad0e7
4 changed files with 53 additions and 26 deletions

View File

@@ -18,6 +18,11 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions ## Recent Reductions
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` erase live
temporary-stroke composite now routes retained setup, sampler bind, texture
bind, draw, and texture unbind ordering through
`execute_legacy_canvas_stroke_temporary_composite(...)`; broader final
composite ownership remains in the legacy Canvas path.
- 2026-06-13: DEBT-0036 was narrowed again. `NodeStrokePreview::stroke_draw_mix()` - 2026-06-13: DEBT-0036 was narrowed again. `NodeStrokePreview::stroke_draw_mix()`
now routes retained mix-pass shader setup plus framebuffer/state/input/draw now routes retained mix-pass shader setup plus framebuffer/state/input/draw
ordering through `execute_legacy_node_stroke_preview_mix_pass(...)`; the ordering through `execute_legacy_node_stroke_preview_mix_pass(...)`; the

View File

@@ -3141,6 +3141,10 @@ Results:
`execute_legacy_canvas_stroke_temporary_composite(...)` for setup, sampler `execute_legacy_canvas_stroke_temporary_composite(...)` for setup, sampler
bind, texture bind, draw, and texture unbind ordering, while erase-path and bind, texture bind, draw, and texture unbind ordering, while erase-path and
broader final composite ownership remain in the legacy Canvas path. broader final composite ownership remain in the legacy Canvas path.
- `Canvas::draw_merge()` erase live temporary-stroke composite now also shares
`execute_legacy_canvas_stroke_temporary_composite(...)`, leaving only the
concrete GL object callbacks and broader final composite ownership in the
legacy Canvas path.
- `NodeStrokePreview::draw_stroke_immediate()` now shares - `NodeStrokePreview::draw_stroke_immediate()` now shares
`execute_legacy_node_stroke_preview_pass_sequence(...)` for `execute_legacy_node_stroke_preview_pass_sequence(...)` for
dual-pass/background/main-pass/final-composite/copy-back ordering, while the dual-pass/background/main-pass/final-composite/copy-back ordering, while the

View File

@@ -509,6 +509,14 @@ Done Checks:
Progress Notes: Progress Notes:
- 2026-06-13: `Canvas::draw_merge()` erase live temporary-stroke composite now
routes retained setup, sampler bind, texture bind, draw, and texture unbind
ordering through `execute_legacy_canvas_stroke_temporary_composite(...)`;
both live temporary composite branches now share the same retained execution
helper while `Canvas` keeps only concrete GL object callbacks and broader
final composite ownership. Next slice should target the remaining final
composite seam without reopening landed sample, mix, dirty, or framebuffer
helpers.
- 2026-06-13: `NodeStrokePreview::stroke_draw_mix()` now routes retained - 2026-06-13: `NodeStrokePreview::stroke_draw_mix()` now routes retained
mix-pass shader setup plus framebuffer/state/input/draw ordering through mix-pass shader setup plus framebuffer/state/input/draw ordering through
`execute_legacy_node_stroke_preview_mix_pass(...)`, with compositor coverage `execute_legacy_node_stroke_preview_mix_pass(...)`, with compositor coverage

View File

@@ -1408,10 +1408,8 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
if (m_current_stroke && m_current_mode == kCanvasMode::Erase && m_show_tmp && m_current_layer_idx == layer_index) if (m_current_stroke && m_current_mode == kCanvasMode::Erase && m_show_tmp && m_current_layer_idx == layer_index)
{ {
m_sampler.bind(0); pp::panopainter::execute_legacy_canvas_stroke_temporary_composite(
m_sampler.bind(1); [&] {
m_sampler.bind(2);
//ShaderManager::u_vec2(kShaderUniform::Resolution, zw(m_box) / zoom); //ShaderManager::u_vec2(kShaderUniform::Resolution, zw(m_box) / zoom);
//ShaderManager::u_int(kShaderUniform::Lock, m_layers[layer_index]->m_alpha_locked); //ShaderManager::u_int(kShaderUniform::Lock, m_layers[layer_index]->m_alpha_locked);
pp::panopainter::setup_legacy_stroke_erase_shader( pp::panopainter::setup_legacy_stroke_erase_shader(
@@ -1423,18 +1421,30 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
.alpha = m_layers[layer_index]->m_opacity, .alpha = m_layers[layer_index]->m_opacity,
.mask_enabled = m_smask_active, .mask_enabled = m_smask_active,
}); });
},
[&] {
m_sampler.bind(0);
m_sampler.bind(1);
m_sampler.bind(2);
},
[&] {
set_active_texture_unit(0); set_active_texture_unit(0);
m_layers[layer_index]->rtt(plane_index).bindTexture(); m_layers[layer_index]->rtt(plane_index).bindTexture();
set_active_texture_unit(1); set_active_texture_unit(1);
m_tmp[plane_index].bindTexture(); m_tmp[plane_index].bindTexture();
set_active_texture_unit(2); set_active_texture_unit(2);
m_smask.rtt(plane_index).bindTexture(); m_smask.rtt(plane_index).bindTexture();
},
[&] {
m_plane.draw_fill(); m_plane.draw_fill();
},
[&] {
m_smask.rtt(plane_index).unbindTexture(); m_smask.rtt(plane_index).unbindTexture();
set_active_texture_unit(1); set_active_texture_unit(1);
m_tmp[plane_index].unbindTexture(); m_tmp[plane_index].unbindTexture();
set_active_texture_unit(0); set_active_texture_unit(0);
m_layers[layer_index]->rtt(plane_index).unbindTexture(); m_layers[layer_index]->rtt(plane_index).unbindTexture();
});
} }
else if (m_current_stroke && m_show_tmp && m_current_layer_idx == layer_index) else if (m_current_stroke && m_show_tmp && m_current_layer_idx == layer_index)
{ {