Extract pad destination texture dispatch helper
This commit is contained in:
@@ -271,12 +271,10 @@ void retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_
|
||||
[&] { events.emplace_back("bind:mixer"); },
|
||||
[&] { events.emplace_back("unbind:mixer"); });
|
||||
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_input(
|
||||
LegacyCanvasStrokeTextureInput::pattern,
|
||||
dispatch);
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_input(
|
||||
LegacyCanvasStrokeTextureInput::mixer,
|
||||
dispatch);
|
||||
dispatch.activate_texture_unit(2);
|
||||
dispatch.bind_pattern();
|
||||
dispatch.activate_texture_unit(3);
|
||||
dispatch.unbind_mixer();
|
||||
|
||||
const std::vector<std::string> expected_events {
|
||||
"activate:2",
|
||||
@@ -287,6 +285,30 @@ void retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<LegacyCanvasStrokeTextureBinding, 1> bindings {
|
||||
LegacyCanvasStrokeTextureBinding { .input = LegacyCanvasStrokeTextureInput::brush_tip, .slot = 0 },
|
||||
};
|
||||
|
||||
std::vector<std::string> events;
|
||||
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch(
|
||||
[&](int slot) { events.emplace_back("activate:" + std::to_string(slot)); },
|
||||
[&] { events.emplace_back("bind:brush_tip"); },
|
||||
[&] { events.emplace_back("unbind:brush_tip"); });
|
||||
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(bindings, dispatch);
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(bindings, dispatch);
|
||||
|
||||
const std::vector<std::string> expected_events {
|
||||
"activate:0",
|
||||
"bind:brush_tip",
|
||||
"activate:0",
|
||||
"unbind:brush_tip",
|
||||
};
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||
{
|
||||
std::vector<std::string> events;
|
||||
@@ -315,6 +337,30 @@ void retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<LegacyCanvasStrokeTextureBinding, 1> bindings {
|
||||
LegacyCanvasStrokeTextureBinding { .input = LegacyCanvasStrokeTextureInput::stroke_destination, .slot = 1 },
|
||||
};
|
||||
|
||||
std::vector<std::string> events;
|
||||
const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
|
||||
[&](int slot) { events.emplace_back("activate:" + std::to_string(slot)); },
|
||||
[&] { events.emplace_back("bind:destination"); },
|
||||
[&] { events.emplace_back("unbind:destination"); });
|
||||
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(bindings, dispatch);
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(bindings, dispatch);
|
||||
|
||||
const std::vector<std::string> expected_events {
|
||||
"activate:1",
|
||||
"bind:destination",
|
||||
"activate:1",
|
||||
"unbind:destination",
|
||||
};
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_sample_executor_copies_destination_and_expands_quads(pp::tests::Harness& h)
|
||||
{
|
||||
const auto vertices = make_quad_vertices();
|
||||
@@ -1398,6 +1444,12 @@ int main()
|
||||
harness.run(
|
||||
"retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||
retained_stroke_main_pass_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||
harness.run(
|
||||
"retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||
retained_stroke_pad_destination_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||
harness.run(
|
||||
"retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring",
|
||||
retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_callback_wiring);
|
||||
harness.run(
|
||||
"retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring",
|
||||
retained_stroke_live_pass_sampler_dispatch_helper_builds_expected_callback_wiring);
|
||||
|
||||
Reference in New Issue
Block a user