Extract stroke dual pass boundary
This commit is contained in:
@@ -509,6 +509,12 @@ Done Checks:
|
|||||||
|
|
||||||
Progress Notes:
|
Progress Notes:
|
||||||
|
|
||||||
|
- 2026-06-13: `Canvas::stroke_draw()` dual-brush replay now routes shader
|
||||||
|
setup, brush-tip texture binding, live-pass execution, and brush-tip
|
||||||
|
unbinding through `execute_legacy_canvas_stroke_dual_pass(...)`; the live
|
||||||
|
adapter still owns the concrete texture callbacks and face-frame replay.
|
||||||
|
Next slice should target another narrow `stroke_draw()` seam without
|
||||||
|
reopening landed pad or sample helpers.
|
||||||
- 2026-06-13: `Canvas::stroke_draw()` now routes the pad-stroke destination
|
- 2026-06-13: `Canvas::stroke_draw()` now routes the pad-stroke destination
|
||||||
texture dispatch through a local helper lambda, so the repeated bind/unbind
|
texture dispatch through a local helper lambda, so the repeated bind/unbind
|
||||||
callback construction is centralized while the pad executor still owns the
|
callback construction is centralized while the pad executor still owns the
|
||||||
|
|||||||
@@ -906,14 +906,25 @@ void Canvas::stroke_draw()
|
|||||||
if (stroke_material.dual_pass.enabled && m_dual_stroke)
|
if (stroke_material.dual_pass.enabled && m_dual_stroke)
|
||||||
{
|
{
|
||||||
const auto& dual_brush = m_dual_stroke->m_brush;
|
const auto& dual_brush = m_dual_stroke->m_brush;
|
||||||
pp::panopainter::setup_legacy_stroke_dual_shader(stroke_material.dual_pass.uses_pattern);
|
|
||||||
|
|
||||||
constexpr std::array dual_pass_texture_bindings {
|
constexpr std::array dual_pass_texture_bindings {
|
||||||
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
||||||
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
|
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
|
||||||
.slot = 0,
|
.slot = 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
auto frames_dual = stroke_draw_compute(*m_dual_stroke);
|
||||||
|
const std::array<bool, 6> include_dual_dirty =
|
||||||
|
SIXPLETTE(stroke_material.composite_pass.dual_blend_mode == 0);
|
||||||
|
[[maybe_unused]] const auto dual_result =
|
||||||
|
pp::panopainter::execute_legacy_canvas_stroke_dual_pass(
|
||||||
|
pp::panopainter::LegacyCanvasStrokeDualPassRequest {
|
||||||
|
.context = "Canvas::stroke_draw",
|
||||||
|
.planes = dual_pass_texture_bindings,
|
||||||
|
.setup_dual_shader = [&] {
|
||||||
|
pp::panopainter::setup_legacy_stroke_dual_shader(
|
||||||
|
stroke_material.dual_pass.uses_pattern);
|
||||||
|
},
|
||||||
|
.bind_brush_tip = [&] {
|
||||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||||
dual_pass_texture_bindings,
|
dual_pass_texture_bindings,
|
||||||
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
||||||
@@ -925,15 +936,9 @@ void Canvas::stroke_draw()
|
|||||||
dual_brush->m_tip_texture->bind() :
|
dual_brush->m_tip_texture->bind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
},
|
},
|
||||||
.unbind_brush_tip = [&] {
|
|
||||||
dual_brush->m_tip_texture ?
|
|
||||||
dual_brush->m_tip_texture->unbind() :
|
|
||||||
unbind_texture_2d();
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
auto frames_dual = stroke_draw_compute(*m_dual_stroke);
|
},
|
||||||
const std::array<bool, 6> include_dual_dirty =
|
.execute_frame_pass = [&] {
|
||||||
SIXPLETTE(stroke_material.composite_pass.dual_blend_mode == 0);
|
|
||||||
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
|
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
|
||||||
frames_dual,
|
frames_dual,
|
||||||
stroke_extent,
|
stroke_extent,
|
||||||
@@ -954,7 +959,8 @@ void Canvas::stroke_draw()
|
|||||||
},
|
},
|
||||||
m_tmp_dual,
|
m_tmp_dual,
|
||||||
true);
|
true);
|
||||||
|
},
|
||||||
|
.unbind_brush_tip = [&] {
|
||||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||||
dual_pass_texture_bindings,
|
dual_pass_texture_bindings,
|
||||||
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
|
||||||
@@ -967,6 +973,8 @@ void Canvas::stroke_draw()
|
|||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pp::panopainter::unbind_legacy_canvas_stroke_sampler_inputs(
|
pp::panopainter::unbind_legacy_canvas_stroke_sampler_inputs(
|
||||||
|
|||||||
@@ -179,9 +179,42 @@ struct LegacyCanvasStrokeMixPassResult {
|
|||||||
std::size_t composed_planes = 0;
|
std::size_t composed_planes = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LegacyCanvasStrokeDualPassRequest {
|
||||||
|
std::string_view context;
|
||||||
|
std::span<const LegacyCanvasStrokeMixPassPlane> planes;
|
||||||
|
std::function<void()> bind_brush_tip;
|
||||||
|
std::function<void()> unbind_brush_tip;
|
||||||
|
std::function<void()> setup_dual_shader;
|
||||||
|
std::function<void()> execute_frame_pass;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LegacyCanvasStrokeDualPassResult {
|
||||||
|
bool ok = false;
|
||||||
|
std::size_t composed_planes = 0;
|
||||||
|
};
|
||||||
|
|
||||||
[[nodiscard]] inline LegacyCanvasStrokeMixPassResult execute_legacy_canvas_stroke_mix_pass(
|
[[nodiscard]] inline LegacyCanvasStrokeMixPassResult execute_legacy_canvas_stroke_mix_pass(
|
||||||
const LegacyCanvasStrokeMixPassRequest& request);
|
const LegacyCanvasStrokeMixPassRequest& request);
|
||||||
|
|
||||||
|
[[nodiscard]] inline LegacyCanvasStrokeDualPassResult execute_legacy_canvas_stroke_dual_pass(
|
||||||
|
const LegacyCanvasStrokeDualPassRequest& request)
|
||||||
|
{
|
||||||
|
LegacyCanvasStrokeDualPassResult result;
|
||||||
|
if (!request.setup_dual_shader ||
|
||||||
|
!request.bind_brush_tip ||
|
||||||
|
!request.unbind_brush_tip ||
|
||||||
|
!request.execute_frame_pass) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.setup_dual_shader();
|
||||||
|
request.bind_brush_tip();
|
||||||
|
request.execute_frame_pass();
|
||||||
|
request.unbind_brush_tip();
|
||||||
|
result.ok = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
template <std::size_t PlaneCount, typename HasTarget>
|
template <std::size_t PlaneCount, typename HasTarget>
|
||||||
[[nodiscard]] inline std::array<LegacyCanvasStrokeMixPassPlane, PlaneCount>
|
[[nodiscard]] inline std::array<LegacyCanvasStrokeMixPassPlane, PlaneCount>
|
||||||
plan_legacy_canvas_stroke_mix_pass_planes(
|
plan_legacy_canvas_stroke_mix_pass_planes(
|
||||||
|
|||||||
Reference in New Issue
Block a user