Route stroke frame-face traversal through helper
This commit is contained in:
@@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat.
|
||||
|
||||
## Recent Reductions
|
||||
|
||||
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw` current and
|
||||
dual stroke frame-face traversal now routes through the retained stroke
|
||||
execution helper; framebuffer binding, shader uniform timing, dirty-box
|
||||
mutation, sampler/texture binding, and live draw execution remain retained.
|
||||
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw_compute`
|
||||
frame planning now routes brush-quad construction, mixer feedback bounds,
|
||||
2D/3D projection selection intent, and frame assembly through the retained
|
||||
|
||||
@@ -3087,6 +3087,10 @@ Results:
|
||||
execution helper for brush-quad construction, mixer feedback bounds, 2D/3D
|
||||
projection selection intent, and frame assembly, while legacy projection
|
||||
geometry, stroke samples, and live draw execution remain retained.
|
||||
- `Canvas::stroke_draw` current and dual stroke frame-face traversal now shares
|
||||
the retained stroke execution helper, while framebuffer binding, shader
|
||||
uniform timing, dirty-box mutation, sampler/texture binding, and live draw
|
||||
execution remain retained.
|
||||
- Remaining simple color, hue, color-quad, grid heightmap, and pen/line
|
||||
preview shader setup in UI nodes and canvas modes now shares retained helper
|
||||
surfaces, while geometry, texture/sampler binding, blend/depth state,
|
||||
|
||||
@@ -690,18 +690,15 @@ void Canvas::stroke_draw()
|
||||
std::array<glm::vec4, 6> box_face = SIXPLETTE(glm::vec4(m_size, 0, 0));
|
||||
std::array<bool, 6> box_dirty = SIXPLETTE(false);
|
||||
glm::vec4 pad_color;
|
||||
for (auto& f : frames)
|
||||
{
|
||||
pp::panopainter::execute_legacy_canvas_stroke_frame_faces(
|
||||
frames,
|
||||
[&](auto& f) {
|
||||
if (brush->m_tip_mix > 0.f)
|
||||
{
|
||||
stroke_draw_mix(xy(f.m_mixer_rect), zw(f.m_mixer_rect));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
auto& P = f.shapes[i];
|
||||
if (P.size() < 3)
|
||||
continue;
|
||||
},
|
||||
[&](auto& f, int i, auto& P) {
|
||||
m_dirty_face[i] = true;
|
||||
merge_faces[i] = true;
|
||||
box_dirty[i] = true;
|
||||
@@ -731,8 +728,7 @@ void Canvas::stroke_draw()
|
||||
box_face[i] = dirty_update.pass_dirty_box;
|
||||
// TODO: maybe average color?
|
||||
pad_color = f.col;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
set_active_texture_unit(3);
|
||||
m_mixer.unbindTexture();
|
||||
@@ -812,19 +808,17 @@ void Canvas::stroke_draw()
|
||||
dual_brush->m_tip_texture->bind() :
|
||||
unbind_texture_2d();
|
||||
auto frames_dual = stroke_draw_compute(*m_dual_stroke);
|
||||
for (auto& f : frames_dual)
|
||||
{
|
||||
pp::panopainter::execute_legacy_canvas_stroke_frame_faces(
|
||||
frames_dual,
|
||||
[&](auto& f) {
|
||||
pp::panopainter::apply_legacy_stroke_sample_uniforms(
|
||||
pp::panopainter::LegacyStrokeSampleUniforms {
|
||||
.color = f.col,
|
||||
.alpha = f.flow,
|
||||
.opacity = f.opacity,
|
||||
});
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
auto& P = f.shapes[i];
|
||||
if (P.size() < 3)
|
||||
continue;
|
||||
},
|
||||
[&](auto&, int i, auto& P) {
|
||||
m_tmp_dual[i].bindFramebuffer();
|
||||
auto box_sample = stroke_draw_samples(i, P, copy_stroke_destination);
|
||||
m_tmp_dual[i].unbindFramebuffer();
|
||||
@@ -840,8 +834,7 @@ void Canvas::stroke_draw()
|
||||
stroke_material.composite_pass.dual_blend_mode == 0,
|
||||
});
|
||||
m_dirty_box[i] = dirty_update.accumulated_dirty_box;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m_sampler_brush.unbind();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "util.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
@@ -152,6 +153,27 @@ template <typename ProjectStroke, typename MakeFrame>
|
||||
return frames;
|
||||
}
|
||||
|
||||
template <typename Frames, typename BeginFrame, typename ExecuteFace>
|
||||
std::size_t execute_legacy_canvas_stroke_frame_faces(
|
||||
Frames&& frames,
|
||||
BeginFrame&& begin_frame,
|
||||
ExecuteFace&& execute_face)
|
||||
{
|
||||
std::size_t executed_faces = 0;
|
||||
for (auto& frame : frames) {
|
||||
begin_frame(frame);
|
||||
for (int face_index = 0; face_index < 6; ++face_index) {
|
||||
auto& vertices = frame.shapes[face_index];
|
||||
if (vertices.size() < 3) {
|
||||
continue;
|
||||
}
|
||||
execute_face(frame, face_index, vertices);
|
||||
++executed_faces;
|
||||
}
|
||||
}
|
||||
return executed_faces;
|
||||
}
|
||||
|
||||
[[nodiscard]] inline pp::paint_renderer::CanvasStrokeBox legacy_canvas_stroke_box(glm::vec4 box) noexcept
|
||||
{
|
||||
return pp::paint_renderer::CanvasStrokeBox {
|
||||
|
||||
Reference in New Issue
Block a user