Extract Canvas draw_merge layer texture helper

This commit is contained in:
2026-06-13 11:49:40 +02:00
parent ed95b084f0
commit 3f8c25d78b
5 changed files with 49 additions and 7 deletions

View File

@@ -18,6 +18,11 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` now routes
the standard per-layer texture-alpha pass through
`execute_legacy_canvas_draw_merge_layer_texture(...)`; per-plane iteration,
temporary-stroke branch selection, and concrete layer RTT ownership remain in
the legacy Canvas path.
- 2026-06-13: DEBT-0036 was narrowed again. `NodeStrokePreview::draw_stroke_immediate()`
now routes retained preview feedback/material/composite planning plus stroke
shader uniform assembly through

View File

@@ -67,6 +67,9 @@ Recent 2026-06-13 retained preview reductions continue to narrow DEBT-0036:
feedback/material/composite planning and stroke-shader uniform assembly through
`plan_legacy_node_stroke_preview_pass_orchestration(...)`, leaving the preview
node with a smaller live-GL callback surface around pass execution.
`Canvas::draw_merge()` also now routes its standard per-layer texture-alpha pass
through `execute_legacy_canvas_draw_merge_layer_texture(...)`, reducing another
piece of retained layer-composite sequencing.
## Target Component Architecture

View File

@@ -509,6 +509,13 @@ Done Checks:
Progress Notes:
- 2026-06-13: `Canvas::draw_merge()` now routes the standard per-layer
texture-alpha pass through
`execute_legacy_canvas_draw_merge_layer_texture(...)`; temporary-stroke
branches, per-plane iteration, and concrete RTT ownership remain local to
`Canvas`. Next slice should target another narrow draw-merge execution seam
without reopening landed temporary-composite, layer-blend, final-plane, or
texture-alpha helpers.
- 2026-06-13: `NodeStrokePreview::draw_stroke_immediate()` now routes retained
preview feedback/material/composite planning plus stroke-shader uniform
assembly through `plan_legacy_node_stroke_preview_pass_orchestration(...)`;

View File

@@ -1518,19 +1518,28 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
}
else
{
m_cam_fov < 20.f ? m_sampler_nearest.bind(0) : m_sampler.bind(0);
pp::panopainter::setup_legacy_canvas_draw_merge_texture_alpha_shader(
pp::panopainter::execute_legacy_canvas_draw_merge_layer_texture(
pp::panopainter::LegacyCanvasDrawMergeTextureAlphaUniforms {
.mvp = ortho,
.texture_slot = 0,
.alpha = m_layers[layer_index]->m_opacity,
.highlight = m_layers[layer_index]->m_hightlight,
},
pp::panopainter::LegacyCanvasDrawMergeLayerTextureExecution {
.bind_sampler = [&] {
m_cam_fov < 20.f ? m_sampler_nearest.bind(0) : m_sampler.bind(0);
},
.bind_layer_texture = [&] {
set_active_texture_unit(0);
m_layers[layer_index]->rtt(plane_index).bindTexture();
},
.draw = [&] {
m_plane.draw_fill();
},
.unbind_layer_texture = [&] {
m_layers[layer_index]->rtt(plane_index).unbindTexture();
},
});
set_active_texture_unit(0);
m_layers[layer_index]->rtt(plane_index).bindTexture();
m_plane.draw_fill();
m_layers[layer_index]->rtt(plane_index).unbindTexture();
}
if (use_blend)

View File

@@ -80,6 +80,13 @@ struct LegacyCanvasDrawMergeLayerBlendExecution {
std::function<void()> unbind_merge_texture;
};
struct LegacyCanvasDrawMergeLayerTextureExecution {
std::function<void()> bind_sampler;
std::function<void()> bind_layer_texture;
std::function<void()> draw;
std::function<void()> unbind_layer_texture;
};
struct LegacyCanvasDrawMergeFinalPlaneCompositeUniforms {
LegacyCanvasDrawMergeCheckerboardUniforms checkerboard;
LegacyCanvasDrawMergeTextureUniforms texture;
@@ -273,6 +280,17 @@ inline void execute_legacy_canvas_draw_merge_layer_blend(
execution.unbind_merge_texture();
}
inline void execute_legacy_canvas_draw_merge_layer_texture(
const LegacyCanvasDrawMergeTextureAlphaUniforms& uniforms,
const LegacyCanvasDrawMergeLayerTextureExecution& execution)
{
execution.bind_sampler();
setup_legacy_canvas_draw_merge_texture_alpha_shader(uniforms);
execution.bind_layer_texture();
execution.draw();
execution.unbind_layer_texture();
}
inline void execute_legacy_canvas_draw_merge_final_plane_composite(
const LegacyCanvasDrawMergeFinalPlaneCompositeUniforms& uniforms,
const LegacyCanvasDrawMergeFinalPlaneCompositeExecution& execution)