diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index d1dd3f8..103921a 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,14 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-13: DEBT-0036 was narrowed again. `NodeViewport` retained preview + draw and `NodePanelGrid` sun-overlay `Texture` shader setup now route + through `legacy_canvas_draw_merge_services.h`; the node paths still own + texture/sampler binding, viewport/state setup, and draw execution. +- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::import_layer` retained + object-draw `Texture` shader setup now routes through + `legacy_canvas_draw_merge_services.h`; import_layer still owns texture upload, + sampler/texture binding, draw callbacks, and object geometry. - 2026-06-13: DEBT-0036 was narrowed again. `NodeImage` and `NodeImageTexture` retained plain image `Texture` shader setup now routes through `legacy_canvas_draw_merge_services.h`; the nodes still own diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 1c4fe08..f9c6ca0 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -3021,6 +3021,10 @@ Results: 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::import_layer` retained object drawing now shares the draw-merge + texture shader setup helper for flat and spherical imports, while texture + upload, sampler/texture binding, draw callbacks, and object geometry remain in + retained Canvas code. - `Canvas::thumbnail_generate` checkerboard redraw and final texture blending now share the retained draw-merge shader setup helpers, while destination copies, sampler/texture binding, readback, and draw execution remain in @@ -3040,6 +3044,10 @@ Results: retained draw-merge texture shader setup helper for `Texture`, `Tex`, and `MVP` setup. Texture/sampler binding, atlas setup, blend state, and draw execution remain in the node paths. +- `NodeViewport` preview drawing and `NodePanelGrid` sun-overlay drawing now + share the retained draw-merge texture shader setup helper for `Texture`, + `Tex`, and `MVP` setup. Texture/sampler binding, viewport/state setup, and + draw execution remain in the node paths. - `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 bb93cdc..ec672f9 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -2049,9 +2049,11 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt m_sampler.bind(0); set_active_texture_unit(0); tex.bind(); - ShaderManager::use(kShader::Texture); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_mat4(kShaderUniform::MVP, glm::scale(glm::vec3(-1, -1, 1))); + pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader( + pp::panopainter::LegacyCanvasDrawMergeTextureUniforms { + .mvp = glm::scale(glm::vec3(-1, -1, 1)), + .texture_slot = 0, + }); plane.draw_fill(); tex.unbind(); m_sampler.unbind(); @@ -2069,10 +2071,12 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt m_sampler.bind(0); set_active_texture_unit(0); tex.bind(); - ShaderManager::use(kShader::Texture); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_mat4(kShaderUniform::MVP, proj * camera * - glm::eulerAngleY(glm::radians(180.f)) * glm::scale(glm::vec3(1, -1, 1))); + pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader( + pp::panopainter::LegacyCanvasDrawMergeTextureUniforms { + .mvp = proj * camera * + glm::eulerAngleY(glm::radians(180.f)) * glm::scale(glm::vec3(1, -1, 1)), + .texture_slot = 0, + }); sphere.draw_fill(); tex.unbind(); m_sampler.unbind(); diff --git a/src/node_panel_grid.cpp b/src/node_panel_grid.cpp index 2a352f8..619d412 100644 --- a/src/node_panel_grid.cpp +++ b/src/node_panel_grid.cpp @@ -1,5 +1,6 @@ #include "pch.h" #include "app_core/grid_ui.h" +#include "legacy_canvas_draw_merge_services.h" #include "legacy_grid_ui_services.h" #include "legacy_ui_overlay_services.h" #include "log.h" @@ -343,11 +344,11 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer auto aspect_ratio = static_cast(viewport.height) / static_cast(viewport.width); apply_grid_capability(pp::renderer::gl::blend_state(), true); apply_grid_capability(pp::renderer::gl::depth_test_state(), false); - ShaderManager::use(kShader::Texture); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-1.f, 1.f, -1.f, 1.f) * - //glm::scale(glm::vec3(100)) * - glm::translate(glm::vec3(p2d, 0)) * glm::scale(glm::vec3(.1f * aspect_ratio, .1f, 1.f))); + pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({ + .mvp = glm::ortho(-1.f, 1.f, -1.f, 1.f) * + //glm::scale(glm::vec3(100)) * + glm::translate(glm::vec3(p2d, 0)) * glm::scale(glm::vec3(.1f * aspect_ratio, .1f, 1.f)), + .texture_slot = 0}); set_grid_active_texture_unit(0U); m_sampler_linear.bind(0); constexpr auto sun_tex = const_hash("data/sun.png"); diff --git a/src/node_viewport.cpp b/src/node_viewport.cpp index 1b3f36c..9bc7cca 100644 --- a/src/node_viewport.cpp +++ b/src/node_viewport.cpp @@ -2,6 +2,7 @@ #include +#include "legacy_canvas_draw_merge_services.h" #include "log.h" #include "legacy_ui_gl_dispatch.h" #include "node_viewport.h" @@ -28,9 +29,7 @@ void NodeViewport::draw() TextureManager::get(m_tex_id).bind(); m_sampler->bind(0); pp::legacy::ui_gl::set_blend_enabled(true, "NodeViewport"); - ShaderManager::use(kShader::Texture); - ShaderManager::u_int(kShaderUniform::Tex, 0); - ShaderManager::u_mat4(kShaderUniform::MVP, proj * cam); + pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({.mvp = proj * cam, .texture_slot = 0}); m_faces->draw_fill(); m_sampler->unbind(); TextureManager::get(m_tex_id).unbind();