Route draw merge blend setup through helper

This commit is contained in:
2026-06-13 05:12:06 +02:00
parent ea1557f7ea
commit 14a6fc2e57
3 changed files with 20 additions and 6 deletions

View File

@@ -18,6 +18,12 @@ 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` non-stroke
`TextureBlend` shader setup now routes through
`legacy_canvas_draw_merge_services.h`, preserving the optional `TexBG`
uniform only when copy-based blend destination feedback is active. Canvas
still owns draw-merge layer iteration, framebuffer copies, sampler/texture
binding, and draw ordering.
- 2026-06-13: DEBT-0036 was narrowed again. `NodeCanvas` non-stroke - 2026-06-13: DEBT-0036 was narrowed again. `NodeCanvas` non-stroke
`TextureBlend` shader setup now routes through `TextureBlend` shader setup now routes through
`legacy_canvas_draw_merge_services.h`, including the optional destination `legacy_canvas_draw_merge_services.h`, including the optional destination

View File

@@ -2992,6 +2992,11 @@ Results:
checkerboard backgrounds and the final merged texture redraw over the grid; checkerboard backgrounds and the final merged texture redraw over the grid;
layer traversal, blend destination copies, sampler/texture binding, and draw layer traversal, blend destination copies, sampler/texture binding, and draw
ordering remain in the legacy Canvas path. ordering remain in the legacy Canvas path.
- `Canvas::draw_merge` non-stroke layer blending now shares the retained
draw-merge shader setup helper for `TextureBlend` uniforms, preserving the
optional `TexBG` uniform when copy-based blend destination feedback is active.
Layer traversal, framebuffer copies, sampler/texture binding, and draw
ordering remain in the legacy Canvas path.
- `Canvas::stroke_draw_mix` now shares the retained stroke composite shader - `Canvas::stroke_draw_mix` now shares the retained stroke composite shader
helper for mixer-pass `CompDraw` setup, while preserving its caller-specific helper for mixer-pass `CompDraw` setup, while preserving its caller-specific
texture slot uniforms. Mixer framebuffer/scissor state, sampler and texture texture slot uniforms. Mixer framebuffer/scissor state, sampler and texture

View File

@@ -1411,15 +1411,18 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
m_sampler.bind(0); m_sampler.bind(0);
m_sampler.bind(2); m_sampler.bind(2);
ShaderManager::use(kShader::TextureBlend); pp::panopainter::setup_legacy_canvas_draw_merge_texture_blend_shader(
ShaderManager::u_int(kShaderUniform::Tex, 0); pp::panopainter::LegacyCanvasDrawMergeTextureBlendUniforms {
ShaderManager::u_int(kShaderUniform::BlendMode, m_layers[layer_index]->m_blend_mode); .mvp = ortho,
ShaderManager::u_float(kShaderUniform::Alpha, 1.f); .texture_slot = 0,
ShaderManager::u_mat4(kShaderUniform::MVP, ortho); .destination_texture_slot = 2,
.use_destination_texture = copy_blend_destination,
.blend_mode = m_layers[layer_index]->m_blend_mode,
.alpha = 1.f,
});
if (copy_blend_destination) if (copy_blend_destination)
{ {
m_sampler.bind(2); m_sampler.bind(2);
ShaderManager::u_int(kShaderUniform::TexBG, 2);
} }
set_active_texture_unit(0); set_active_texture_unit(0);