Wrap stroke mix shell bundle

This commit is contained in:
2026-06-13 19:21:42 +02:00
parent a428f77db6
commit a6855fca05
5 changed files with 132 additions and 58 deletions

View File

@@ -403,7 +403,7 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
return current_layer.face(plane_index);
});
const auto& b = m_current_stroke->m_brush;
const auto mix_setup = pp::panopainter::make_legacy_canvas_stroke_mix_pass_setup(
const auto mix_shell = pp::panopainter::make_legacy_canvas_stroke_mix_pass_shell(
[&] {
m_mixer.bindFramebuffer();
apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight());
@@ -421,63 +421,9 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
});
[[maybe_unused]] const auto mix_result =
pp::panopainter::execute_legacy_canvas_stroke_mix_pass_shell(
mix_setup.begin,
mix_setup.end,
pp::panopainter::make_legacy_canvas_stroke_mix_pass_request(
"Canvas::stroke_draw_mix",
m_size,
mix_planes,
[&] {
m_sampler.bind(0);
m_sampler.bind(1);
m_sampler.bind(2);
},
[&] {
m_sampler.unbind();
},
[&](int plane_index, const glm::mat4& plane_mvp_z) {
(void)plane_index;
pp::panopainter::setup_legacy_stroke_composite_shader(
pp::panopainter::LegacyStrokeCompositeUniforms {
.resolution = m_size,
.mvp = plane_mvp_z,
.pattern_texture_slot = 3,
.layer_alpha = 1.0f,
.alpha_lock = false, /*current_layer.m_alpha_locked*/
.mask_enabled = false, /*m_smask_active*/
.use_fragcoord = false,
.blend_mode = b->m_blend_mode,
.use_dual = false,
.use_pattern = false,
});
},
[&](int plane_index) {
set_active_texture_unit(0);
current_layer.rtt(plane_index).bindTexture();
},
[&](int plane_index) {
set_active_texture_unit(1);
m_tmp[plane_index].bindTexture();
},
[&](int plane_index) {
set_active_texture_unit(2);
m_smask.rtt(plane_index).bindTexture();
},
[&] {
m_node->m_face_plane.draw_fill();
},
[&](int plane_index) {
set_active_texture_unit(2);
m_smask.rtt(plane_index).unbindTexture();
},
[&](int plane_index) {
set_active_texture_unit(1);
m_tmp[plane_index].unbindTexture();
},
[&](int plane_index) {
set_active_texture_unit(0);
current_layer.rtt(plane_index).unbindTexture();
}));
mix_shell.setup.begin,
mix_shell.setup.end,
mix_shell.request);
gl.restore();
}