Route canvas mode and preview 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
|
||||
|
||||
- 2026-06-13: DEBT-0036 was narrowed again. `CanvasModeTransform::on_Draw`
|
||||
and `CanvasModeFloodFill::on_Draw` retained `Texture` shader setup now route
|
||||
through `legacy_canvas_draw_merge_services.h`; the mode paths still own
|
||||
active texture selection, sampler/texture binding, and draw execution.
|
||||
- 2026-06-13: DEBT-0036 was narrowed again. `NodeStrokePreview::draw`
|
||||
retained preview `Texture` shader setup now routes through
|
||||
`legacy_canvas_draw_merge_services.h`; the node still owns preview texture
|
||||
binding, sampler binding, and draw execution.
|
||||
- 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
|
||||
|
||||
@@ -3021,6 +3021,9 @@ 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.
|
||||
- `NodeStrokePreview::draw` now shares the retained draw-merge texture shader
|
||||
setup helper for preview `Texture`, `Tex`, and `MVP` setup, while preview
|
||||
texture binding, sampler binding, and draw execution remain in the node path.
|
||||
- `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
|
||||
@@ -3048,6 +3051,10 @@ Results:
|
||||
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.
|
||||
- `CanvasModeTransform::on_Draw` and `CanvasModeFloodFill::on_Draw` now share
|
||||
the retained draw-merge texture shader setup helper for `Texture`, `Tex`, and
|
||||
`MVP` setup. Active texture selection, sampler/texture binding, and draw
|
||||
execution remain in the canvas mode 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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "canvas.h"
|
||||
#include "shader.h"
|
||||
#include "node_canvas.h"
|
||||
#include "legacy_canvas_draw_merge_services.h"
|
||||
#include "legacy_canvas_stroke_composite_services.h"
|
||||
#include "legacy_ui_overlay_services.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
@@ -1526,9 +1527,10 @@ void CanvasModeTransform::on_Draw(const glm::mat4& ortho, const glm::mat4& proj,
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, { 0, 1, 1, .1 });
|
||||
m_shape[i].draw_fill();
|
||||
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * camera * m_xform * m_xform_local);
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({
|
||||
.mvp = proj * camera * m_xform * m_xform_local,
|
||||
.texture_slot = 0,
|
||||
});
|
||||
set_canvas_mode_active_texture_unit(0);
|
||||
m_tex[i].bind();
|
||||
Canvas::I->m_sampler_linear.bind(0);
|
||||
@@ -1754,15 +1756,14 @@ void CanvasModeFloodFill::on_Draw(const glm::mat4& ortho, const glm::mat4& proj,
|
||||
{
|
||||
if (m_draw_tip)
|
||||
{
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP,
|
||||
glm::scale(glm::vec3(1, -1, 1))
|
||||
* ortho
|
||||
* glm::translate(glm::vec3(Canvas::I->m_cur_pos, 0.f))
|
||||
* glm::scale(glm::vec3(32, 32, 1))
|
||||
* glm::translate(glm::vec3(0.5f, -0.5f, 0))
|
||||
);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({
|
||||
.mvp = glm::scale(glm::vec3(1, -1, 1))
|
||||
* ortho
|
||||
* glm::translate(glm::vec3(Canvas::I->m_cur_pos, 0.f))
|
||||
* glm::scale(glm::vec3(32, 32, 1))
|
||||
* glm::translate(glm::vec3(0.5f, -0.5f, 0)),
|
||||
.texture_slot = 0,
|
||||
});
|
||||
|
||||
auto& t = TextureManager::get(m_cursor_id);
|
||||
|
||||
|
||||
@@ -775,9 +775,11 @@ void NodeStrokePreview::draw_stroke()
|
||||
|
||||
void NodeStrokePreview::draw()
|
||||
{
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||
.mvp = m_mvp,
|
||||
.texture_slot = 0,
|
||||
});
|
||||
m_tex_preview.bind();
|
||||
m_sampler_linear.bind(0);
|
||||
m_plane.draw_fill();
|
||||
|
||||
Reference in New Issue
Block a user