Isolate legacy stroke edge shader setup

This commit is contained in:
2026-06-12 22:44:15 +02:00
parent e5d5d5f9ce
commit 2ee6534918
4 changed files with 87 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
#include "app.h"
#include "legacy_gl_renderbuffer_dispatch.h"
#include "legacy_canvas_stroke_composite_services.h"
#include "legacy_canvas_stroke_edge_services.h"
#include "legacy_canvas_stroke_execution_services.h"
#include "legacy_canvas_stroke_shader_services.h"
#include "legacy_canvas_stroke_services.h"
@@ -765,12 +766,14 @@ void Canvas::stroke_draw()
// NOTE: at the moment this works on the whole canvas, but it can be optimized
// to only affect the current dirty box. In this case it may be necessary to do this
// work on documents that doesn't have the padding, so on document loading.
ShaderManager::use(kShader::StrokePad);
ShaderManager::u_vec4(kShaderUniform::Col, pad_color);
pp::panopainter::setup_legacy_stroke_pad_shader(
pp::panopainter::LegacyStrokePadUniforms {
.color = pad_color,
.uses_destination_feedback = copy_stroke_destination,
});
if (copy_stroke_destination)
{
set_active_texture_unit(1);
ShaderManager::u_int(kShaderUniform::TexBG, 1);
}
for (int i = 0; i < 6; i++)
{
@@ -1122,9 +1125,10 @@ void Canvas::stroke_commit()
// }
// Dilate borders to avoid interpolation bleeding
ShaderManager::use(kShader::StrokeDilate);
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
ShaderManager::u_int(kShaderUniform::TexBG, 0);
pp::panopainter::setup_legacy_stroke_dilate_shader(
pp::panopainter::LegacyStrokeDilateUniforms {
.mvp = glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f),
});
set_active_texture_unit(0);
m_tex2[i].bind();
copy_framebuffer_to_texture_2d(0, 0, 0, 0, m_width, m_height);