diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 47c16b2..edfa513 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,12 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::layer_merge` now reuses + `legacy_canvas_stroke_composite_services.h` for retained layer-merge + `kShader::CompDraw` binding and source/destination blend uniform writes. + Render-task ordering, dirty face/box mutation, framebuffer copies, sampler + binding, texture binding, and draw execution remain in the retained Canvas + layer-merge path. - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_commit` now routes its retained per-face commit order through `execute_legacy_canvas_stroke_commit_sequence`, consuming the tested diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index b419dd4..ef65be1 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -2984,6 +2984,10 @@ Results: through retained callbacks, so the legacy body no longer owns the loop order directly. The callbacks still execute the existing OpenGL RTT, texture, sampler, shader, history, and layer mutation work under DEBT-0036. +- `Canvas::layer_merge` now shares the retained stroke composite shader helper + for its source-over-destination `CompDraw` uniform setup, while keeping the + existing layer dirty mutation, framebuffer copy, texture binding, and draw + order local to the Canvas layer-merge path. - Canvas thumbnail layer blending now uses the same canvas destination-feedback plan for framebuffer-fetch versus texture-copy decisions; the thumbnail draw itself still executes through retained OpenGL canvas code under DEBT-0036. diff --git a/src/canvas.cpp b/src/canvas.cpp index 9e34f3e..21032d0 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -1636,17 +1636,19 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index m_sampler.bind(0); m_sampler_nearest.bind(1); { - ShaderManager::use(kShader::CompDraw); - ShaderManager::u_int(kShaderUniform::Tex, 0); // dest - ShaderManager::u_int(kShaderUniform::TexStroke, 1); // source - ShaderManager::u_vec2(kShaderUniform::Resolution, m_size); - ShaderManager::u_float(kShaderUniform::Alpha, m_layers[source_idx]->m_opacity); - ShaderManager::u_int(kShaderUniform::Lock, false); - ShaderManager::u_int(kShaderUniform::UseFragcoord, false); - ShaderManager::u_int(kShaderUniform::BlendMode, m_layers[source_idx]->m_blend_mode); - ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f)); - ShaderManager::u_int(kShaderUniform::UseDual, false); - ShaderManager::u_int(kShaderUniform::UsePattern, false); + pp::panopainter::setup_legacy_stroke_composite_shader( + pp::panopainter::LegacyStrokeCompositeUniforms { + .resolution = m_size, + .mvp = glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f), + .layer_alpha = m_layers[source_idx]->m_opacity, + .alpha_lock = false, + .mask_enabled = false, + .use_fragcoord = false, + .blend_mode = m_layers[source_idx]->m_blend_mode, + .use_dual = false, + .dual_alpha = 0.0f, + .use_pattern = false, + }); set_active_texture_unit(0); m_tex2[i].bind();