Route thumbnail and node image texture setup through helpers
This commit is contained in:
@@ -18,6 +18,14 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Recent Reductions
|
## Recent Reductions
|
||||||
|
|
||||||
|
- 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
|
||||||
|
texture/sampler binding, atlas setup, blend state, and draw execution.
|
||||||
|
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::thumbnail_generate`
|
||||||
|
checkerboard and final `Texture` shader setup now route through
|
||||||
|
`legacy_canvas_draw_merge_services.h`; thumbnail generation still owns
|
||||||
|
destination copies, sampler/texture binding, readback, and draw execution.
|
||||||
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_objects` retained
|
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_objects` retained
|
||||||
object composite `Texture` shader setup now routes through
|
object composite `Texture` shader setup now routes through
|
||||||
`legacy_canvas_draw_merge_services.h`; draw_objects still owns temporary
|
`legacy_canvas_draw_merge_services.h`; draw_objects still owns temporary
|
||||||
|
|||||||
@@ -3021,6 +3021,10 @@ Results:
|
|||||||
stroke composite shader setup helper, while render-task ordering, framebuffer
|
stroke composite shader setup helper, while render-task ordering, framebuffer
|
||||||
copy bounds, sampler/texture binding, and draw execution remain in retained
|
copy bounds, sampler/texture binding, and draw execution remain in retained
|
||||||
canvas-mode code.
|
canvas-mode 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
|
||||||
|
retained Canvas code.
|
||||||
- `Canvas::draw_objects` retained object compositing now shares the retained
|
- `Canvas::draw_objects` retained object compositing now shares the retained
|
||||||
draw-merge texture shader setup helper, while temporary face readback,
|
draw-merge texture shader setup helper, while temporary face readback,
|
||||||
sampler/texture binding, draw execution, and dirty-box updates remain in
|
sampler/texture binding, draw execution, and dirty-box updates remain in
|
||||||
@@ -3032,6 +3036,10 @@ Results:
|
|||||||
draw-merge shader setup helper for per-layer `TextureBlend` uniforms, while
|
draw-merge shader setup helper for per-layer `TextureBlend` uniforms, while
|
||||||
destination feedback copies, sampler/texture binding, grid redraw, readback,
|
destination feedback copies, sampler/texture binding, grid redraw, readback,
|
||||||
and draw execution remain in retained Canvas code.
|
and draw execution remain in retained Canvas code.
|
||||||
|
- `NodeImage` and `NodeImageTexture` retained plain image drawing now share the
|
||||||
|
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.
|
||||||
- `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
|
||||||
|
|||||||
@@ -3031,15 +3031,19 @@ Image Canvas::thumbnail_generate(int w, int h)
|
|||||||
copy_framebuffer_to_texture_2d(0, 0, 0, 0, w, h);
|
copy_framebuffer_to_texture_2d(0, 0, 0, 0, w, h);
|
||||||
|
|
||||||
// draw the grid
|
// draw the grid
|
||||||
ShaderManager::use(kShader::Checkerboard);
|
pp::panopainter::setup_legacy_canvas_draw_merge_checkerboard_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp);
|
pp::panopainter::LegacyCanvasDrawMergeCheckerboardUniforms {
|
||||||
|
.mvp = plane_mvp,
|
||||||
|
});
|
||||||
m_face_plane.draw_fill();
|
m_face_plane.draw_fill();
|
||||||
|
|
||||||
// now blend with the background
|
// now blend with the background
|
||||||
apply_canvas_capability(blend_state(), true);
|
apply_canvas_capability(blend_state(), true);
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
.mvp = glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f),
|
||||||
|
.texture_slot = 0,
|
||||||
|
});
|
||||||
m_sampler.bind(0); // linear
|
m_sampler.bind(0); // linear
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "legacy_canvas_draw_merge_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_image.h"
|
#include "node_image.h"
|
||||||
@@ -109,13 +110,14 @@ void NodeImage::draw()
|
|||||||
ShaderManager::use(kShader::Atlas);
|
ShaderManager::use(kShader::Atlas);
|
||||||
ShaderManager::u_vec2(kShaderUniform::Tof, m_off);
|
ShaderManager::u_vec2(kShaderUniform::Tof, m_off);
|
||||||
ShaderManager::u_vec2(kShaderUniform::Tsz, m_sz);
|
ShaderManager::u_vec2(kShaderUniform::Tsz, m_sz);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::scale(glm::vec3(m_scale, 1.f)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||||
|
{.mvp = m_mvp * glm::scale(glm::vec3(m_scale, 1.f)), .texture_slot = 0});
|
||||||
}
|
}
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::scale(glm::vec3(m_scale, 1.f)));
|
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
sampler.unbind();
|
sampler.unbind();
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImage");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImage");
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "legacy_canvas_draw_merge_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_image_texture.h"
|
#include "node_image_texture.h"
|
||||||
@@ -23,9 +24,7 @@ void NodeImageTexture::draw()
|
|||||||
auto& sampler = tex && tex->has_mips ? NodeImage::m_sampler_mips : NodeImage::m_sampler;
|
auto& sampler = tex && tex->has_mips ? NodeImage::m_sampler_mips : NodeImage::m_sampler;
|
||||||
sampler.bind(0);
|
sampler.bind(0);
|
||||||
pp::legacy::ui_gl::set_blend_enabled(true, "NodeImageTexture");
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeImageTexture");
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({.mvp = m_mvp, .texture_slot = 0});
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
|
||||||
NodeImage::m_plane.draw_fill();
|
NodeImage::m_plane.draw_fill();
|
||||||
sampler.unbind();
|
sampler.unbind();
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImageTexture");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImageTexture");
|
||||||
|
|||||||
Reference in New Issue
Block a user