From 76f006184017742dc49c07cac7afee1c332c9a62 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 05:27:01 +0200 Subject: [PATCH] Route mask cut composite setup through helper --- docs/modernization/debt.md | 5 +++++ docs/modernization/roadmap.md | 4 ++++ src/canvas_modes.cpp | 27 +++++++++++++++------------ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 3d3637e..3a309c3 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -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. `CanvasModeMaskCut::apply` + retained `CompDraw` shader setup now routes through + `legacy_canvas_stroke_composite_services.h`; mask-cut still owns render-task + ordering, framebuffer copy bounds, sampler/texture binding, and draw + execution. - 2026-06-13: DEBT-0036 was narrowed again. Desktop VR retained temporary erase and draw shader setup now route through the shared stroke erase/composite helpers; VR still owns sampler/texture binding, per-eye/view transforms, diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index f8a1bed..2747269 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -3017,6 +3017,10 @@ Results: erase and composite shader setup helpers, while sampler/texture binding, per-eye/view transforms, temporary stroke texture selection, and draw execution remain in retained VR code. +- `CanvasModeMaskCut::apply` retained mask-cut compositing now shares the + stroke composite shader setup helper, while render-task ordering, framebuffer + copy bounds, sampler/texture binding, and draw execution remain in retained + canvas-mode code. - `Canvas::stroke_draw_mix` now shares the retained stroke composite shader helper for mixer-pass `CompDraw` setup, while preserving its caller-specific texture slot uniforms. Mixer framebuffer/scissor state, sampler and texture diff --git a/src/canvas_modes.cpp b/src/canvas_modes.cpp index 9096571..8f6f8af 100644 --- a/src/canvas_modes.cpp +++ b/src/canvas_modes.cpp @@ -8,6 +8,7 @@ #include "canvas.h" #include "shader.h" #include "node_canvas.h" +#include "legacy_canvas_stroke_composite_services.h" #include "legacy_ui_overlay_services.h" #include "legacy_ui_gl_dispatch.h" #include "app.h" @@ -1478,18 +1479,20 @@ void CanvasModeTransform::leave(kCanvasMode next) set_canvas_mode_active_texture_unit(1); for (int j = 0; j < 6; j++) { - ShaderManager::use(kShader::CompDraw); - ShaderManager::u_mat4(kShaderUniform::MVP, mvp); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_int(kShaderUniform::TexStroke, 1); - ShaderManager::u_float(kShaderUniform::Alpha, 1); - ShaderManager::u_int(kShaderUniform::UseFragcoord, true); - ShaderManager::u_int(kShaderUniform::Lock, false); - ShaderManager::u_int(kShaderUniform::Mask, false); - ShaderManager::u_vec2(kShaderUniform::Resolution, Canvas::I->m_size); - ShaderManager::u_int(kShaderUniform::BlendMode, 0); - ShaderManager::u_int(kShaderUniform::UseDual, false); - ShaderManager::u_int(kShaderUniform::UsePattern, false); + pp::panopainter::setup_legacy_stroke_composite_shader( + pp::panopainter::LegacyStrokeCompositeUniforms { + .resolution = Canvas::I->m_size, + .mvp = mvp, + .texture_slot = 0, + .stroke_texture_slot = 1, + .layer_alpha = 1.0f, + .alpha_lock = false, + .mask_enabled = false, + .use_fragcoord = true, + .blend_mode = 0, + .use_dual = false, + .use_pattern = false, + }); Canvas::I->m_sampler_linear.bind(1); Canvas::I->m_sampler_linear.bind(0); m_tex[j].bind();