Reuse stroke sampler dispatch helper
This commit is contained in:
@@ -509,6 +509,11 @@ Done Checks:
|
|||||||
|
|
||||||
Progress Notes:
|
Progress Notes:
|
||||||
|
|
||||||
|
- 2026-06-13: `Canvas::stroke_draw()` live-pass sampler dispatch now reuses a
|
||||||
|
retained helper builder for brush-tip, destination, pattern, and mixer
|
||||||
|
sampler callbacks; the live adapter still owns the concrete sampler objects.
|
||||||
|
Next slice should target another narrow `stroke_draw()` seam without
|
||||||
|
reopening landed texture or dual-pass helpers.
|
||||||
- 2026-06-13: `Canvas::stroke_draw()` main-pass texture dispatch now reuses
|
- 2026-06-13: `Canvas::stroke_draw()` main-pass texture dispatch now reuses
|
||||||
retained helper builders for texture-unit, brush-tip, pattern, and mixer
|
retained helper builders for texture-unit, brush-tip, pattern, and mixer
|
||||||
callback wiring; the live adapter still owns the concrete textures and
|
callback wiring; the live adapter still owns the concrete textures and
|
||||||
|
|||||||
@@ -731,32 +731,32 @@ void Canvas::stroke_draw()
|
|||||||
.slot = 0,
|
.slot = 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const pp::panopainter::LegacyCanvasStrokeSamplerDispatch live_pass_sampler_dispatch {
|
const pp::panopainter::LegacyCanvasStrokeSamplerDispatch live_pass_sampler_dispatch =
|
||||||
.bind_brush_tip_sampler = [&](int slot) {
|
pp::panopainter::make_legacy_canvas_stroke_sampler_dispatch(
|
||||||
m_sampler_brush.bind(slot);
|
[&](int slot) {
|
||||||
},
|
m_sampler_brush.bind(slot);
|
||||||
.unbind_brush_tip_sampler = [&] {
|
},
|
||||||
m_sampler_brush.unbind();
|
[&] {
|
||||||
},
|
m_sampler_brush.unbind();
|
||||||
.bind_stroke_destination_sampler = [&](int slot) {
|
},
|
||||||
m_sampler_nearest.bind(slot);
|
[&](int slot) {
|
||||||
},
|
m_sampler_nearest.bind(slot);
|
||||||
.unbind_stroke_destination_sampler = [&] {
|
},
|
||||||
m_sampler_nearest.unbind();
|
[&] {
|
||||||
},
|
m_sampler_nearest.unbind();
|
||||||
.bind_pattern_sampler = [&](int slot) {
|
},
|
||||||
m_sampler_stencil.bind(slot);
|
[&](int slot) {
|
||||||
},
|
m_sampler_stencil.bind(slot);
|
||||||
.unbind_pattern_sampler = [&] {
|
},
|
||||||
m_sampler_stencil.unbind();
|
[&] {
|
||||||
},
|
m_sampler_stencil.unbind();
|
||||||
.bind_mixer_sampler = [&](int slot) {
|
},
|
||||||
m_sampler.bind(slot);
|
[&](int slot) {
|
||||||
},
|
m_sampler.bind(slot);
|
||||||
.unbind_mixer_sampler = [&] {
|
},
|
||||||
m_sampler.unbind();
|
[&] {
|
||||||
},
|
m_sampler.unbind();
|
||||||
};
|
});
|
||||||
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch main_pass_texture_dispatch {
|
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch main_pass_texture_dispatch {
|
||||||
pp::panopainter::make_legacy_canvas_stroke_main_pass_texture_dispatch(
|
pp::panopainter::make_legacy_canvas_stroke_main_pass_texture_dispatch(
|
||||||
[&](int texture_slot) {
|
[&](int texture_slot) {
|
||||||
|
|||||||
@@ -127,6 +127,28 @@ struct LegacyCanvasStrokeSamplerDispatch {
|
|||||||
std::function<void()> unbind_mixer_sampler;
|
std::function<void()> unbind_mixer_sampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] inline LegacyCanvasStrokeSamplerDispatch make_legacy_canvas_stroke_sampler_dispatch(
|
||||||
|
std::function<void(int)> bind_brush_tip_sampler,
|
||||||
|
std::function<void()> unbind_brush_tip_sampler,
|
||||||
|
std::function<void(int)> bind_stroke_destination_sampler,
|
||||||
|
std::function<void()> unbind_stroke_destination_sampler,
|
||||||
|
std::function<void(int)> bind_pattern_sampler,
|
||||||
|
std::function<void()> unbind_pattern_sampler,
|
||||||
|
std::function<void(int)> bind_mixer_sampler,
|
||||||
|
std::function<void()> unbind_mixer_sampler)
|
||||||
|
{
|
||||||
|
return LegacyCanvasStrokeSamplerDispatch {
|
||||||
|
.bind_brush_tip_sampler = std::move(bind_brush_tip_sampler),
|
||||||
|
.unbind_brush_tip_sampler = std::move(unbind_brush_tip_sampler),
|
||||||
|
.bind_stroke_destination_sampler = std::move(bind_stroke_destination_sampler),
|
||||||
|
.unbind_stroke_destination_sampler = std::move(unbind_stroke_destination_sampler),
|
||||||
|
.bind_pattern_sampler = std::move(bind_pattern_sampler),
|
||||||
|
.unbind_pattern_sampler = std::move(unbind_pattern_sampler),
|
||||||
|
.bind_mixer_sampler = std::move(bind_mixer_sampler),
|
||||||
|
.unbind_mixer_sampler = std::move(unbind_mixer_sampler),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
struct LegacyCanvasStrokeFaceDirtyRequest {
|
struct LegacyCanvasStrokeFaceDirtyRequest {
|
||||||
pp::renderer::Extent2D extent {};
|
pp::renderer::Extent2D extent {};
|
||||||
glm::vec4 previous_accumulated_dirty_box {};
|
glm::vec4 previous_accumulated_dirty_box {};
|
||||||
|
|||||||
Reference in New Issue
Block a user