From b98635a8bb874fa8bbcaa86042fc5955f396ffc2 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 05:30:31 +0200 Subject: [PATCH] Route thumbnail blend setup through helper --- docs/modernization/debt.md | 5 +++++ docs/modernization/roadmap.md | 4 ++++ src/canvas.cpp | 15 +++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index dbcaf52..ad62c29 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. `Canvas::thumbnail_generate` + thumbnail layer `TextureBlend` shader setup now routes through + `legacy_canvas_draw_merge_services.h`; thumbnail generation still owns + destination feedback copies, sampler/texture binding, grid redraw, readback, + and draw execution. - 2026-06-13: DEBT-0036 was narrowed again. Desktop VR checkerboard background shader setup now routes through `legacy_canvas_draw_merge_services.h`; VR still owns render state transitions, per-plane transforms, and draw diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 1cf844f..d757caf 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -3024,6 +3024,10 @@ Results: - Desktop VR checkerboard background drawing now shares the retained draw-merge shader setup helper, while render state transitions, per-plane transforms, and draw execution remain in retained VR code. +- `Canvas::thumbnail_generate` thumbnail layer blending now shares the retained + draw-merge shader setup helper for per-layer `TextureBlend` uniforms, while + destination feedback copies, sampler/texture binding, grid redraw, readback, + and draw execution remain in retained Canvas 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.cpp b/src/canvas.cpp index 7adac0d..073dd7b 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -2986,12 +2986,8 @@ Image Canvas::thumbnail_generate(int w, int h) apply_canvas_capability(blend_state(), false); auto plane_mvp = proj * m_mv * m_plane_transform[i] * glm::translate(glm::vec3(0, 0, -1)); - ShaderManager::use(kShader::TextureBlend); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp); if (copy_layer_destination) { - ShaderManager::u_int(kShaderUniform::TexBG, 2); set_active_texture_unit(2); blendtex.bind(); m_sampler_nearest.bind(2); @@ -3008,8 +3004,15 @@ Image Canvas::thumbnail_generate(int w, int h) set_active_texture_unit(2); copy_framebuffer_to_texture_2d(0, 0, 0, 0, w, h); } - ShaderManager::u_int(kShaderUniform::BlendMode, m_layers[layer_index]->m_blend_mode); - ShaderManager::u_float(kShaderUniform::Alpha, m_layers[layer_index]->m_opacity); + pp::panopainter::setup_legacy_canvas_draw_merge_texture_blend_shader( + pp::panopainter::LegacyCanvasDrawMergeTextureBlendUniforms { + .mvp = plane_mvp, + .texture_slot = 0, + .destination_texture_slot = 2, + .use_destination_texture = copy_layer_destination, + .blend_mode = m_layers[layer_index]->m_blend_mode, + .alpha = m_layers[layer_index]->m_opacity, + }); set_active_texture_unit(0); m_layers[layer_index]->rtt(i).bindTexture(); m_face_plane.draw_fill();