Route stroke pad planning through helper

This commit is contained in:
2026-06-13 06:34:04 +02:00
parent 13f334ae55
commit b8c6e11f41
4 changed files with 39 additions and 18 deletions

View File

@@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions ## Recent Reductions
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw` pad-region
planning now routes through the retained stroke execution helper wrapping
`pp_paint_renderer`; pad color selection, dirty-face iteration,
framebuffer copies, quad upload, and draw execution remain retained.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw` face - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw` face
dirty-box planning now routes through a retained stroke execution helper dirty-box planning now routes through a retained stroke execution helper
wrapping `pp_paint_renderer`, retained stroke commit step dispatch clamps wrapping `pp_paint_renderer`, retained stroke commit step dispatch clamps

View File

@@ -3079,6 +3079,10 @@ Results:
compositor coverage now includes malformed retained commit plans plus compositor coverage now includes malformed retained commit plans plus
all-input stroke-preview composite planning. Live stroke rasterization, all-input stroke-preview composite planning. Live stroke rasterization,
callback execution, texture binding, and history mutation remain retained. callback execution, texture binding, and history mutation remain retained.
- `Canvas::stroke_draw` pad-region planning now shares the retained stroke
execution helper wrapping `pp_paint_renderer`, while pad color selection,
dirty-face iteration, framebuffer copies, quad upload, and draw execution
remain retained.
- Remaining simple color, hue, color-quad, grid heightmap, and pen/line - Remaining simple color, hue, color-quad, grid heightmap, and pen/line
preview shader setup in UI nodes and canvas modes now shares retained helper preview shader setup in UI nodes and canvas modes now shares retained helper
surfaces, while geometry, texture/sampler binding, blend/depth state, surfaces, while geometry, texture/sampler binding, blend/depth state,

View File

@@ -95,21 +95,6 @@ pp::renderer::Extent2D canvas_stroke_extent(int width, int height) noexcept
}; };
} }
pp::paint_renderer::CanvasStrokeBox canvas_stroke_box(glm::vec4 box) noexcept
{
return pp::paint_renderer::CanvasStrokeBox {
.min_x = box.x,
.min_y = box.y,
.max_x = box.z,
.max_y = box.w,
};
}
glm::vec4 glm_box(pp::paint_renderer::CanvasStrokeBox box) noexcept
{
return glm::vec4(box.min_x, box.min_y, box.max_x, box.max_y);
}
pp::paint_renderer::CanvasBlendGatePlan draw_merge_blend_gate_plan( pp::paint_renderer::CanvasBlendGatePlan draw_merge_blend_gate_plan(
int width, int width,
int height, int height,
@@ -822,10 +807,10 @@ void Canvas::stroke_draw()
{ {
if (!box_dirty[i]) if (!box_dirty[i])
continue; continue;
const auto pad_region = pp::paint_renderer::plan_canvas_stroke_pad_region( const auto pad_region = pp::panopainter::plan_legacy_canvas_stroke_pad_region(
pp::paint_renderer::CanvasStrokePadRegionRequest { pp::panopainter::LegacyCanvasStrokePadRegionRequest {
.extent = stroke_extent, .extent = stroke_extent,
.pass_dirty_box = canvas_stroke_box(box_face[i]), .pass_dirty_box = box_face[i],
}); });
if (!pad_region.has_pixels) if (!pad_region.has_pixels)
continue; continue;

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include "paint_renderer/compositor.h" #include "paint_renderer/compositor.h"
#include "../libs/glm/glm/glm.hpp"
#include "util.h" #include "util.h"
#include <array> #include <array>
@@ -46,6 +47,17 @@ struct LegacyCanvasStrokeFaceDirtyResult {
bool pass_dirty = false; bool pass_dirty = false;
}; };
struct LegacyCanvasStrokePadRegionRequest {
pp::renderer::Extent2D extent {};
glm::vec4 pass_dirty_box {};
};
struct LegacyCanvasStrokePadRegionResult {
bool has_pixels = false;
pp::paint_renderer::CanvasStrokeCopyRegion copy_region {};
std::array<pp::paint_renderer::CanvasStrokePoint, 6> ndc_quad {};
};
[[nodiscard]] inline pp::paint_renderer::CanvasStrokeBox legacy_canvas_stroke_box(glm::vec4 box) noexcept [[nodiscard]] inline pp::paint_renderer::CanvasStrokeBox legacy_canvas_stroke_box(glm::vec4 box) noexcept
{ {
return pp::paint_renderer::CanvasStrokeBox { return pp::paint_renderer::CanvasStrokeBox {
@@ -62,6 +74,22 @@ struct LegacyCanvasStrokeFaceDirtyResult {
return glm::vec4(box.min_x, box.min_y, box.max_x, box.max_y); return glm::vec4(box.min_x, box.min_y, box.max_x, box.max_y);
} }
[[nodiscard]] inline LegacyCanvasStrokePadRegionResult plan_legacy_canvas_stroke_pad_region(
const LegacyCanvasStrokePadRegionRequest& request) noexcept
{
const auto plan = pp::paint_renderer::plan_canvas_stroke_pad_region(
pp::paint_renderer::CanvasStrokePadRegionRequest {
.extent = request.extent,
.pass_dirty_box = legacy_canvas_stroke_box(request.pass_dirty_box),
});
return LegacyCanvasStrokePadRegionResult {
.has_pixels = plan.has_pixels,
.copy_region = plan.copy_region,
.ndc_quad = plan.ndc_quad,
};
}
[[nodiscard]] inline LegacyCanvasStrokeFaceDirtyResult plan_legacy_canvas_stroke_face_dirty_update( [[nodiscard]] inline LegacyCanvasStrokeFaceDirtyResult plan_legacy_canvas_stroke_face_dirty_update(
const LegacyCanvasStrokeFaceDirtyRequest& request) noexcept const LegacyCanvasStrokeFaceDirtyRequest& request) noexcept
{ {