Extract main stroke live-pass orchestration

This commit is contained in:
2026-06-13 18:44:36 +02:00
parent 93a5d1ac07
commit 58885187ba
5 changed files with 119 additions and 39 deletions

View File

@@ -780,51 +780,67 @@ void Canvas::stroke_draw()
[&] {
m_mixer.unbindTexture();
});
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_bindings,
main_pass_texture_dispatch);
auto frames = stroke_draw_compute(*m_current_stroke);
std::array<glm::vec4, 6> box_face = SIXPLETTE(glm::vec4(m_size, 0, 0));
std::array<bool, 6> box_dirty = SIXPLETTE(false);
const std::array<bool, 6> include_main_dirty = SIXPLETTE(true);
glm::vec4 pad_color;
pp::panopainter::execute_legacy_canvas_stroke_main_pass_frame_callbacks(
frames,
stroke_extent,
std::span<glm::vec4>(m_dirty_box),
std::span<glm::vec4>(box_face),
std::span<const bool>(include_main_dirty),
[&](auto& f) {
if (brush->m_tip_mix > 0.f)
{
stroke_draw_mix(xy(f.m_mixer_rect), zw(f.m_mixer_rect));
}
pad_color = f.col;
},
[&](auto&, int i, auto&) {
m_dirty_face[i] = true;
box_dirty[i] = true;
},
[&](auto& f, int i, auto& P) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = f.col,
.alpha = f.flow,
.opacity = f.opacity,
});
return stroke_draw_samples(i, P, copy_stroke_destination);
},
m_tmp);
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_unbindings,
main_pass_texture_dispatch);
[[maybe_unused]] const auto main_pass_result =
pp::panopainter::execute_legacy_canvas_stroke_main_pass(
pp::panopainter::LegacyCanvasStrokeMainPassExecutionRequest {
.context = "Canvas::stroke_draw",
.bind_samplers = [&] {
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
},
.bind_textures = [&] {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_bindings,
main_pass_texture_dispatch);
},
.execute_frame_pass = [&] {
pp::panopainter::execute_legacy_canvas_stroke_main_pass_frame_callbacks(
frames,
stroke_extent,
std::span<glm::vec4>(m_dirty_box),
std::span<glm::vec4>(box_face),
std::span<const bool>(include_main_dirty),
[&](auto& f) {
if (brush->m_tip_mix > 0.f)
{
stroke_draw_mix(xy(f.m_mixer_rect), zw(f.m_mixer_rect));
}
pad_color = f.col;
},
[&](auto&, int i, auto&) {
m_dirty_face[i] = true;
box_dirty[i] = true;
},
[&](auto& f, int i, auto& P) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = f.col,
.alpha = f.flow,
.opacity = f.opacity,
});
return stroke_draw_samples(i, P, copy_stroke_destination);
},
m_tmp);
},
.unbind_textures = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
main_pass_texture_unbindings,
main_pass_texture_dispatch);
},
.unbind_samplers = [&] {
pp::panopainter::unbind_legacy_canvas_stroke_sampler_inputs(
live_pass_sampler_bindings,
live_pass_sampler_dispatch);
},
});
// pad stroke
// In order to mitigate color bleeding at the edge of shapes in transparent layers