Extract dual stroke face execution

This commit is contained in:
2026-06-13 17:56:48 +02:00
parent 779694ae1b
commit ae46be9f90
5 changed files with 114 additions and 2 deletions

View File

@@ -71,6 +71,11 @@ agent or engineer to remove them without reconstructing context from chat.
`execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(...)`; the `execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(...)`; the
retained path still owns the concrete framebuffer array and per-face GL retained path still owns the concrete framebuffer array and per-face GL
callbacks. callbacks.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw()` dual-pass
face execution now routes through
`execute_legacy_canvas_stroke_dual_pass_frame_callbacks(...)`; the retained
path still owns the concrete dual-brush shader, sampler, and framebuffer
wiring.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw_samples()` - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw_samples()`
now routes polygon triangulation, sample-point assembly, and retained now routes polygon triangulation, sample-point assembly, and retained
destination-copy / upload / draw helper handoff through destination-copy / upload / draw helper handoff through

View File

@@ -883,7 +883,7 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_stroke_ex
### STR-006 - Extract Dual Stroke Face Execution Orchestration ### STR-006 - Extract Dual Stroke Face Execution Orchestration
Status: Ready Status: Done
Score: +1 renderer boundary and OpenGL parity Score: +1 renderer boundary and OpenGL parity
Debt: `DEBT-0036` Debt: `DEBT-0036`
Scope: `src/canvas.cpp`, `src/legacy_canvas_stroke_execution_services.h`, Scope: `src/canvas.cpp`, `src/legacy_canvas_stroke_execution_services.h`,
@@ -910,3 +910,9 @@ Validation:
ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_stroke_execution" --output-on-failure ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_stroke_execution" --output-on-failure
& 'C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe' out\build\windows-msvc-default\tests\pp_paint_renderer_stroke_execution_tests.vcxproj /p:Configuration=Debug /p:Platform=x64 & 'C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe' out\build\windows-msvc-default\tests\pp_paint_renderer_stroke_execution_tests.vcxproj /p:Configuration=Debug /p:Platform=x64
``` ```
### Completed Task Log
| Date | Task | Score | Validation | Commit |
| --- | --- | ---: | --- | --- |
| 2026-06-13 | STR-006 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_stroke_execution" --output-on-failure`; `MSBuild.exe out\build\windows-msvc-default\tests\pp_paint_renderer_stroke_execution_tests.vcxproj /p:Configuration=Debug /p:Platform=x64` | pending |

View File

@@ -941,7 +941,7 @@ void Canvas::stroke_draw()
})); }));
}, },
.execute_frame_pass = [&] { .execute_frame_pass = [&] {
pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers( pp::panopainter::execute_legacy_canvas_stroke_dual_pass_frame_callbacks(
frames_dual, frames_dual,
stroke_extent, stroke_extent,
std::span<glm::vec4>(m_dirty_box), std::span<glm::vec4>(m_dirty_box),

View File

@@ -308,6 +308,36 @@ std::size_t execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
std::span<bool> committed_dirty_faces = {}, std::span<bool> committed_dirty_faces = {},
std::span<bool> pass_dirty_faces = {}); std::span<bool> pass_dirty_faces = {});
template <typename Frames, typename Framebuffers, typename BeginFrame, typename PrepareFace, typename ExecuteSample>
std::size_t execute_legacy_canvas_stroke_dual_pass_frame_callbacks(
Frames&& frames,
pp::renderer::Extent2D extent,
std::span<glm::vec4> accumulated_dirty_boxes,
std::span<glm::vec4> pass_dirty_boxes,
std::span<const bool> include_in_committed_dirty_box,
BeginFrame&& begin_frame,
PrepareFace&& prepare_face,
ExecuteSample&& execute_sample,
Framebuffers& face_framebuffers,
bool preserve_sample_dirty_as_pass_dirty = false,
std::span<bool> committed_dirty_faces = {},
std::span<bool> pass_dirty_faces = {})
{
return execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
std::forward<Frames>(frames),
extent,
accumulated_dirty_boxes,
pass_dirty_boxes,
include_in_committed_dirty_box,
std::forward<BeginFrame>(begin_frame),
std::forward<PrepareFace>(prepare_face),
std::forward<ExecuteSample>(execute_sample),
face_framebuffers,
preserve_sample_dirty_as_pass_dirty,
committed_dirty_faces,
pass_dirty_faces);
}
[[nodiscard]] inline LegacyCanvasStrokeDualPassResult execute_legacy_canvas_stroke_dual_pass( [[nodiscard]] inline LegacyCanvasStrokeDualPassResult execute_legacy_canvas_stroke_dual_pass(
const LegacyCanvasStrokeDualPassRequest& request) const LegacyCanvasStrokeDualPassRequest& request)
{ {

View File

@@ -1301,6 +1301,74 @@ void retained_stroke_live_pass_retains_previous_pass_dirty_union_without_overrid
PP_EXPECT(h, pass_dirty_faces[1]); PP_EXPECT(h, pass_dirty_faces[1]);
} }
void retained_stroke_dual_pass_frame_callbacks_preserve_order(pp::tests::Harness& h)
{
StrokeFrame frame;
frame.id = 21;
frame.shapes[0] = {
vertex_t(glm::vec2(1.0F, 1.0F)),
vertex_t(glm::vec2(2.0F, 1.0F)),
vertex_t(glm::vec2(2.0F, 2.0F)),
};
frame.shapes[3] = {
vertex_t(glm::vec2(3.0F, 3.0F)),
vertex_t(glm::vec2(4.0F, 3.0F)),
vertex_t(glm::vec2(4.0F, 4.0F)),
};
std::array<StrokeFrame, 1> frames { frame };
std::array<glm::vec4, 6> accumulated_dirty_boxes;
std::array<glm::vec4, 6> pass_dirty_boxes;
accumulated_dirty_boxes.fill(glm::vec4(64.0F, 64.0F, 0.0F, 0.0F));
pass_dirty_boxes.fill(glm::vec4(64.0F, 64.0F, 0.0F, 0.0F));
std::array<bool, 6> include_in_committed_dirty_box { true, true, true, true, true, true };
std::vector<std::string> events;
std::array<DummyFramebuffer, 6> face_framebuffers {};
for (int face_index = 0; face_index < 6; ++face_index) {
face_framebuffers[face_index].events = &events;
face_framebuffers[face_index].face_index = face_index;
}
const auto executed_faces = pp::panopainter::execute_legacy_canvas_stroke_dual_pass_frame_callbacks(
frames,
pp::renderer::Extent2D { .width = 64, .height = 64 },
accumulated_dirty_boxes,
pass_dirty_boxes,
include_in_committed_dirty_box,
[&](StrokeFrame& current_frame) {
events.push_back("begin-frame:" + std::to_string(current_frame.id));
},
[&](StrokeFrame&, int face_index, std::span<const vertex_t> vertices) {
events.push_back(
"prepare:" + std::to_string(face_index) + ":" + std::to_string(vertices.size()));
},
[&](StrokeFrame&, int face_index, std::span<const vertex_t>) {
events.push_back("execute:" + std::to_string(face_index));
return glm::vec4(
static_cast<float>(face_index + 10),
static_cast<float>(face_index + 11),
static_cast<float>(face_index + 12),
static_cast<float>(face_index + 13));
},
face_framebuffers,
true);
const std::vector<std::string> expected_events {
"begin-frame:21",
"prepare:0:3",
"bind:0",
"execute:0",
"unbind:0",
"prepare:3:3",
"bind:3",
"execute:3",
"unbind:3",
};
PP_EXPECT(h, executed_faces == 2U);
PP_EXPECT(h, events == expected_events);
}
void retained_stroke_pad_executor_copies_destination_for_dirty_faces_only(pp::tests::Harness& h) void retained_stroke_pad_executor_copies_destination_for_dirty_faces_only(pp::tests::Harness& h)
{ {
const std::array<bool, 3> dirty_faces { true, false, true }; const std::array<bool, 3> dirty_faces { true, false, true };
@@ -1573,6 +1641,9 @@ int main()
harness.run( harness.run(
"retained_stroke_live_pass_face_framebuffers_helper_preserves_callback_order", "retained_stroke_live_pass_face_framebuffers_helper_preserves_callback_order",
retained_stroke_live_pass_face_framebuffers_helper_preserves_callback_order); retained_stroke_live_pass_face_framebuffers_helper_preserves_callback_order);
harness.run(
"retained_stroke_dual_pass_frame_callbacks_preserve_order",
retained_stroke_dual_pass_frame_callbacks_preserve_order);
harness.run( harness.run(
"retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring", "retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring",
retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring); retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring);