Add live pass sampler dispatch regression

This commit is contained in:
2026-06-13 23:01:55 +02:00
parent 5c1cfa2b0e
commit d12b57974b
3 changed files with 109 additions and 1 deletions

View File

@@ -1797,6 +1797,101 @@ void legacy_canvas_stroke_main_pass_texture_dispatch_preserves_order(pp::tests::
PP_EXPECT(h, steps == expected);
}
void legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order(pp::tests::Harness& h)
{
std::vector<std::string> steps;
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_live_pass_sampler_dispatch(
[&](int slot) {
steps.emplace_back("activate:" + std::to_string(slot));
},
[&] {
steps.emplace_back("bind-brush");
},
[&] {
steps.emplace_back("unbind-brush");
},
[&] {
steps.emplace_back("bind-pattern");
},
[&] {
steps.emplace_back("unbind-pattern");
},
[&] {
steps.emplace_back("bind-mixer");
},
[&] {
steps.emplace_back("unbind-mixer");
},
[&] {
steps.emplace_back("bind-stencil");
},
[&] {
steps.emplace_back("unbind-stencil");
});
pp::panopainter::bind_legacy_canvas_stroke_sampler_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
.slot = 0,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
.slot = 1,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::pattern,
.slot = 2,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::mixer,
.slot = 3,
},
},
dispatch);
pp::panopainter::unbind_legacy_canvas_stroke_sampler_inputs(
std::array {
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::mixer,
.slot = 3,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::pattern,
.slot = 2,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
.slot = 1,
},
pp::panopainter::LegacyCanvasStrokeTextureBinding {
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
.slot = 0,
},
},
dispatch);
const std::vector<std::string> expected {
"activate:0",
"bind-brush",
"activate:1",
"bind-stencil",
"activate:2",
"bind-pattern",
"activate:3",
"bind-mixer",
"activate:3",
"unbind-mixer",
"activate:2",
"unbind-pattern",
"activate:1",
"unbind-stencil",
"activate:0",
"unbind-brush",
};
PP_EXPECT(h, steps == expected);
}
void plans_canvas_stroke_commit_erase_sequence(pp::tests::Harness& h)
{
const auto plan = plan_canvas_stroke_commit_sequence(
@@ -3669,6 +3764,9 @@ int main()
harness.run(
"legacy_canvas_stroke_main_pass_texture_dispatch_preserves_order",
legacy_canvas_stroke_main_pass_texture_dispatch_preserves_order);
harness.run(
"legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order",
legacy_canvas_stroke_live_pass_sampler_dispatch_preserves_order);
harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence);
harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence);
harness.run(