Extract draw merge temporary paint branch
This commit is contained in:
@@ -198,6 +198,11 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
`make_legacy_canvas_draw_merge_temporary_erase_composite(...)`; the live
|
`make_legacy_canvas_draw_merge_temporary_erase_composite(...)`; the live
|
||||||
path still owns the concrete layer RTT, mixer RTT, sampler, and plane
|
path still owns the concrete layer RTT, mixer RTT, sampler, and plane
|
||||||
callbacks.
|
callbacks.
|
||||||
|
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` temporary
|
||||||
|
paint branch execution now routes through
|
||||||
|
`make_legacy_canvas_draw_merge_temporary_paint_composite(...)`; the live
|
||||||
|
path still owns the concrete layer RTT, mixer RTT, sampler, and plane
|
||||||
|
callbacks.
|
||||||
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` now routes
|
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` now routes
|
||||||
the layer-composite shell through a local wrapper around
|
the layer-composite shell through a local wrapper around
|
||||||
`execute_legacy_canvas_draw_merge_layer_composite(...)`; the final branch
|
`execute_legacy_canvas_draw_merge_layer_composite(...)`; the final branch
|
||||||
|
|||||||
@@ -1485,9 +1485,8 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
|||||||
if (b->m_pattern_flipx) patt_scale.x *= -1.f;
|
if (b->m_pattern_flipx) patt_scale.x *= -1.f;
|
||||||
if (b->m_pattern_flipy) patt_scale.y *= -1.f;
|
if (b->m_pattern_flipy) patt_scale.y *= -1.f;
|
||||||
|
|
||||||
pp::panopainter::execute_legacy_canvas_draw_merge_temporary_composite(
|
const auto execution = pp::panopainter::make_legacy_canvas_draw_merge_temporary_paint_composite(
|
||||||
pp::panopainter::LegacyCanvasDrawMergeTemporaryCompositeExecution {
|
[&] {
|
||||||
.setup = [&] {
|
|
||||||
pp::panopainter::setup_legacy_stroke_composite_shader(
|
pp::panopainter::setup_legacy_stroke_composite_shader(
|
||||||
pp::panopainter::LegacyStrokeCompositeUniforms {
|
pp::panopainter::LegacyStrokeCompositeUniforms {
|
||||||
.resolution = Canvas::I->m_size,
|
.resolution = Canvas::I->m_size,
|
||||||
@@ -1512,14 +1511,14 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
|||||||
.use_pattern = stroke_material.composite_pass.use_pattern,
|
.use_pattern = stroke_material.composite_pass.use_pattern,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
.bind_samplers = [&] {
|
[&] {
|
||||||
m_sampler.bind(0);
|
m_sampler.bind(0);
|
||||||
m_sampler.bind(1);
|
m_sampler.bind(1);
|
||||||
m_sampler.bind(2);
|
m_sampler.bind(2);
|
||||||
m_sampler.bind(3);
|
m_sampler.bind(3);
|
||||||
m_sampler_stencil.bind(4);
|
m_sampler_stencil.bind(4);
|
||||||
},
|
},
|
||||||
.bind_textures = [&] {
|
[&] {
|
||||||
set_active_texture_unit(0);
|
set_active_texture_unit(0);
|
||||||
m_layers[layer_index]->rtt(plane_index).bindTexture();
|
m_layers[layer_index]->rtt(plane_index).bindTexture();
|
||||||
set_active_texture_unit(1);
|
set_active_texture_unit(1);
|
||||||
@@ -1534,10 +1533,10 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
|||||||
b->m_pattern_texture->bind() :
|
b->m_pattern_texture->bind() :
|
||||||
unbind_texture_2d();
|
unbind_texture_2d();
|
||||||
},
|
},
|
||||||
.draw = [&] {
|
[&] {
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
},
|
},
|
||||||
.unbind_textures = [&] {
|
[&] {
|
||||||
set_active_texture_unit(3);
|
set_active_texture_unit(3);
|
||||||
if (stroke_material.composite_pass.use_dual)
|
if (stroke_material.composite_pass.use_dual)
|
||||||
m_tmp_dual[plane_index].unbindTexture();
|
m_tmp_dual[plane_index].unbindTexture();
|
||||||
@@ -1547,8 +1546,8 @@ void Canvas::draw_merge(bool draw_checkerboard, std::array<bool, 6> faces /*= SI
|
|||||||
m_tmp[plane_index].unbindTexture();
|
m_tmp[plane_index].unbindTexture();
|
||||||
set_active_texture_unit(0);
|
set_active_texture_unit(0);
|
||||||
m_layers[layer_index]->rtt(plane_index).unbindTexture();
|
m_layers[layer_index]->rtt(plane_index).unbindTexture();
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
pp::panopainter::execute_legacy_canvas_draw_merge_temporary_composite(execution);
|
||||||
},
|
},
|
||||||
.execute_layer_texture = [&] {
|
.execute_layer_texture = [&] {
|
||||||
execute_canvas_draw_merge_layer_texture(
|
execute_canvas_draw_merge_layer_texture(
|
||||||
|
|||||||
@@ -124,6 +124,28 @@ template <
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename Setup,
|
||||||
|
typename BindSamplers,
|
||||||
|
typename BindTextures,
|
||||||
|
typename Draw,
|
||||||
|
typename UnbindTextures>
|
||||||
|
[[nodiscard]] inline LegacyCanvasDrawMergeTemporaryCompositeExecution make_legacy_canvas_draw_merge_temporary_paint_composite(
|
||||||
|
Setup&& setup,
|
||||||
|
BindSamplers&& bind_samplers,
|
||||||
|
BindTextures&& bind_textures,
|
||||||
|
Draw&& draw,
|
||||||
|
UnbindTextures&& unbind_textures)
|
||||||
|
{
|
||||||
|
return LegacyCanvasDrawMergeTemporaryCompositeExecution {
|
||||||
|
.setup = std::forward<Setup>(setup),
|
||||||
|
.bind_samplers = std::forward<BindSamplers>(bind_samplers),
|
||||||
|
.bind_textures = std::forward<BindTextures>(bind_textures),
|
||||||
|
.draw = std::forward<Draw>(draw),
|
||||||
|
.unbind_textures = std::forward<UnbindTextures>(unbind_textures),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
struct LegacyCanvasDrawMergePlaneSetupUniforms {
|
struct LegacyCanvasDrawMergePlaneSetupUniforms {
|
||||||
LegacyCanvasDrawMergeCheckerboardUniforms checkerboard;
|
LegacyCanvasDrawMergeCheckerboardUniforms checkerboard;
|
||||||
bool use_blend = false;
|
bool use_blend = false;
|
||||||
|
|||||||
@@ -3194,6 +3194,28 @@ void legacy_canvas_draw_merge_temporary_erase_helper_preserves_order(pp::tests::
|
|||||||
PP_EXPECT(h, order == expected);
|
PP_EXPECT(h, order == expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void legacy_canvas_draw_merge_temporary_paint_helper_preserves_order(pp::tests::Harness& h)
|
||||||
|
{
|
||||||
|
std::vector<std::string> order;
|
||||||
|
const auto execution = pp::panopainter::make_legacy_canvas_draw_merge_temporary_paint_composite(
|
||||||
|
[&] { order.emplace_back("setup"); },
|
||||||
|
[&] { order.emplace_back("bind_samplers"); },
|
||||||
|
[&] { order.emplace_back("bind_textures"); },
|
||||||
|
[&] { order.emplace_back("draw"); },
|
||||||
|
[&] { order.emplace_back("unbind_textures"); });
|
||||||
|
|
||||||
|
pp::panopainter::execute_legacy_canvas_draw_merge_temporary_composite(execution);
|
||||||
|
|
||||||
|
const std::vector<std::string> expected {
|
||||||
|
"setup",
|
||||||
|
"bind_samplers",
|
||||||
|
"bind_textures",
|
||||||
|
"draw",
|
||||||
|
"unbind_textures",
|
||||||
|
};
|
||||||
|
PP_EXPECT(h, order == expected);
|
||||||
|
}
|
||||||
|
|
||||||
void plans_canvas_stroke_feedback_paths(pp::tests::Harness& h)
|
void plans_canvas_stroke_feedback_paths(pp::tests::Harness& h)
|
||||||
{
|
{
|
||||||
const Extent2D extent { .width = 32, .height = 16 };
|
const Extent2D extent { .width = 32, .height = 16 };
|
||||||
@@ -3557,6 +3579,9 @@ int main()
|
|||||||
harness.run(
|
harness.run(
|
||||||
"legacy_canvas_draw_merge_temporary_erase_helper_preserves_order",
|
"legacy_canvas_draw_merge_temporary_erase_helper_preserves_order",
|
||||||
legacy_canvas_draw_merge_temporary_erase_helper_preserves_order);
|
legacy_canvas_draw_merge_temporary_erase_helper_preserves_order);
|
||||||
|
harness.run(
|
||||||
|
"legacy_canvas_draw_merge_temporary_paint_helper_preserves_order",
|
||||||
|
legacy_canvas_draw_merge_temporary_paint_helper_preserves_order);
|
||||||
harness.run("plans_canvas_stroke_feedback_paths", plans_canvas_stroke_feedback_paths);
|
harness.run("plans_canvas_stroke_feedback_paths", plans_canvas_stroke_feedback_paths);
|
||||||
harness.run("canvas_stroke_feedback_preserves_legacy_fallback", canvas_stroke_feedback_preserves_legacy_fallback);
|
harness.run("canvas_stroke_feedback_preserves_legacy_fallback", canvas_stroke_feedback_preserves_legacy_fallback);
|
||||||
harness.run("plans_canvas_stroke_rasterization_boundary", plans_canvas_stroke_rasterization_boundary);
|
harness.run("plans_canvas_stroke_rasterization_boundary", plans_canvas_stroke_rasterization_boundary);
|
||||||
|
|||||||
Reference in New Issue
Block a user