Extract stroke mix request wiring

This commit is contained in:
2026-06-13 19:15:42 +02:00
parent 5b76f3d1f9
commit c62a60a4af
5 changed files with 174 additions and 55 deletions

View File

@@ -420,61 +420,60 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
[&] {
m_mixer.unbindFramebuffer();
},
pp::panopainter::LegacyCanvasStrokeMixPassRequest {
.context = "Canvas::stroke_draw_mix",
.resolution = m_size,
.planes = mix_planes,
.bind_mix_samplers = [&] {
m_sampler.bind(0);
m_sampler.bind(1);
m_sampler.bind(2);
},
.unbind_mix_samplers = [&] {
m_sampler.unbind();
},
.setup_plane_shader = [&](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,
});
},
.bind_layer_texture = [&](int plane_index) {
set_active_texture_unit(0);
current_layer.rtt(plane_index).bindTexture();
},
.bind_stroke_texture = [&](int plane_index) {
set_active_texture_unit(1);
m_tmp[plane_index].bindTexture();
},
.bind_mask_texture = [&](int plane_index) {
set_active_texture_unit(2);
m_smask.rtt(plane_index).bindTexture();
},
.draw_plane = [&] {
m_node->m_face_plane.draw_fill();
},
.unbind_mask_texture = [&](int plane_index) {
set_active_texture_unit(2);
m_smask.rtt(plane_index).unbindTexture();
},
.unbind_stroke_texture = [&](int plane_index) {
set_active_texture_unit(1);
m_tmp[plane_index].unbindTexture();
},
.unbind_layer_texture = [&](int plane_index) {
set_active_texture_unit(0);
current_layer.rtt(plane_index).unbindTexture();
},
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();
});
gl.restore();