Add renderer and package readiness validation gates
This commit is contained in:
@@ -33,7 +33,6 @@ using pp::panopainter::LegacyCanvasStrokeSamplerDispatch;
|
||||
using pp::panopainter::LegacyCanvasStrokeTextureBinding;
|
||||
using pp::panopainter::LegacyCanvasStrokeTextureInputDispatch;
|
||||
using pp::panopainter::LegacyCanvasStrokeTextureInput;
|
||||
using pp::panopainter::LegacyStrokePreviewCopySize;
|
||||
using pp::panopainter::LegacyStrokeSampleExecutionRequest;
|
||||
|
||||
std::vector<vertex_t> triangulate_simple(const std::vector<vertex_t>& vertices)
|
||||
@@ -1210,47 +1209,61 @@ void retained_stroke_live_pass_clears_before_traversal_and_copies_afterwards(pp:
|
||||
face_framebuffers[face_index].face_index = face_index;
|
||||
}
|
||||
|
||||
events.emplace_back("clear");
|
||||
const auto executed_faces = pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
|
||||
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));
|
||||
std::size_t executed_faces = 0U;
|
||||
bool copy_ok = false;
|
||||
pp::panopainter::execute_legacy_stroke_preview_live_pass(
|
||||
[&] { events.push_back("clear"); },
|
||||
[&]() {
|
||||
return std::vector<int> { 0 };
|
||||
},
|
||||
[&](StrokeFrame&, int face_index, std::span<const vertex_t> vertices) {
|
||||
events.push_back(
|
||||
"prepare:" + std::to_string(face_index) + ":" + std::to_string(vertices.size()));
|
||||
[&](int&) {},
|
||||
[&](int&) {},
|
||||
[&](int&) {
|
||||
executed_faces = pp::panopainter::execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(
|
||||
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 + 1),
|
||||
static_cast<float>(face_index + 2),
|
||||
static_cast<float>(face_index + 3),
|
||||
static_cast<float>(face_index + 4));
|
||||
},
|
||||
face_framebuffers,
|
||||
true,
|
||||
committed_dirty_faces,
|
||||
pass_dirty_faces);
|
||||
},
|
||||
[&](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 + 1),
|
||||
static_cast<float>(face_index + 2),
|
||||
static_cast<float>(face_index + 3),
|
||||
static_cast<float>(face_index + 4));
|
||||
},
|
||||
face_framebuffers,
|
||||
true,
|
||||
committed_dirty_faces,
|
||||
pass_dirty_faces);
|
||||
|
||||
pp::panopainter::copy_legacy_stroke_preview_texture(
|
||||
[&]() { events.emplace_back("bind-preview"); },
|
||||
[&](int dst_x, int dst_y, int src_x, int src_y, int width, int height) {
|
||||
events.emplace_back("copy-preview");
|
||||
PP_EXPECT(h, dst_x == 0);
|
||||
PP_EXPECT(h, dst_y == 0);
|
||||
PP_EXPECT(h, src_x == 0);
|
||||
PP_EXPECT(h, src_y == 0);
|
||||
PP_EXPECT(h, width == 64);
|
||||
PP_EXPECT(h, height == 64);
|
||||
},
|
||||
LegacyStrokePreviewCopySize { .width = 64, .height = 64 });
|
||||
[&]() {
|
||||
const auto copy_status = pp::paint_renderer::copy_stroke_preview_result_to_texture(
|
||||
[&]() { events.emplace_back("bind-preview"); },
|
||||
[&](int src_x, int src_y, int dst_x, int dst_y, int width, int height) {
|
||||
events.emplace_back("copy-preview");
|
||||
PP_EXPECT(h, src_x == 0);
|
||||
PP_EXPECT(h, src_y == 0);
|
||||
PP_EXPECT(h, dst_x == 0);
|
||||
PP_EXPECT(h, dst_y == 0);
|
||||
PP_EXPECT(h, width == 64);
|
||||
PP_EXPECT(h, height == 64);
|
||||
},
|
||||
pp::paint_renderer::StrokePreviewCopySize { .width = 64, .height = 64 });
|
||||
PP_EXPECT(h, copy_status.ok());
|
||||
copy_ok = copy_status.ok();
|
||||
});
|
||||
|
||||
PP_EXPECT(h, executed_faces == 2U);
|
||||
PP_EXPECT(h, copy_ok);
|
||||
const std::vector<std::string> expected_events {
|
||||
"clear",
|
||||
"begin-frame:9",
|
||||
@@ -1503,6 +1516,164 @@ void retained_stroke_main_pass_execution_preserves_bind_and_unbind_order(pp::tes
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_main_pass_execution_preserves_destination_binding_order_and_face_execution(pp::tests::Harness& h)
|
||||
{
|
||||
std::vector<std::string> events;
|
||||
|
||||
std::array<StrokeFrame, 1> frames {};
|
||||
frames[0].id = 31;
|
||||
frames[0].shapes[2] = {
|
||||
vertex_t(glm::vec2(2.0F, 3.0F)),
|
||||
vertex_t(glm::vec2(4.0F, 3.0F)),
|
||||
vertex_t(glm::vec2(3.0F, 5.0F)),
|
||||
};
|
||||
|
||||
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_main_dirty = SIXPLETTE(true);
|
||||
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 std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 4> main_pass_texture_bindings {
|
||||
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,
|
||||
},
|
||||
};
|
||||
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 3> main_pass_texture_unbindings {
|
||||
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
||||
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::mixer,
|
||||
.slot = 3,
|
||||
},
|
||||
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
||||
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::stroke_destination,
|
||||
.slot = 1,
|
||||
},
|
||||
pp::panopainter::LegacyCanvasStrokeTextureBinding {
|
||||
.input = pp::panopainter::LegacyCanvasStrokeTextureInput::brush_tip,
|
||||
.slot = 0,
|
||||
},
|
||||
};
|
||||
|
||||
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch main_pass_texture_dispatch {
|
||||
.activate_texture_unit = [&](int slot) {
|
||||
events.emplace_back("activate:" + std::to_string(slot));
|
||||
},
|
||||
.bind_brush_tip = [&]() {
|
||||
events.emplace_back("bind-brush");
|
||||
},
|
||||
.unbind_brush_tip = [&]() {
|
||||
events.emplace_back("unbind-brush");
|
||||
},
|
||||
.bind_stroke_destination = [&]() {
|
||||
events.emplace_back("bind-destination");
|
||||
},
|
||||
.unbind_stroke_destination = [&]() {
|
||||
events.emplace_back("unbind-destination");
|
||||
},
|
||||
.bind_pattern = [&]() {
|
||||
events.emplace_back("bind-pattern");
|
||||
},
|
||||
.unbind_pattern = [&]() {
|
||||
events.emplace_back("unbind-pattern");
|
||||
},
|
||||
.bind_mixer = [&]() {
|
||||
events.emplace_back("bind-mixer");
|
||||
},
|
||||
.unbind_mixer = [&]() {
|
||||
events.emplace_back("unbind-mixer");
|
||||
},
|
||||
};
|
||||
|
||||
const auto ok = pp::panopainter::execute_legacy_canvas_stroke_main_pass(
|
||||
pp::panopainter::make_legacy_canvas_stroke_main_pass_execution_request(
|
||||
"Canvas::stroke_draw",
|
||||
[&] {
|
||||
events.emplace_back("bind-samplers");
|
||||
},
|
||||
[&] {
|
||||
events.emplace_back("bind-textures");
|
||||
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
|
||||
main_pass_texture_bindings,
|
||||
main_pass_texture_dispatch);
|
||||
},
|
||||
[&] {
|
||||
pp::panopainter::execute_legacy_canvas_stroke_main_pass_frame_callbacks(
|
||||
frames,
|
||||
pp::renderer::Extent2D { .width = 64, .height = 64 },
|
||||
accumulated_dirty_boxes,
|
||||
pass_dirty_boxes,
|
||||
include_main_dirty,
|
||||
[&](StrokeFrame& frame) {
|
||||
events.emplace_back("begin-frame:" + std::to_string(frame.id));
|
||||
},
|
||||
[&](StrokeFrame&, int face_index, std::span<const vertex_t> vertices) {
|
||||
events.emplace_back(
|
||||
"prepare:" + std::to_string(face_index) + ":" + std::to_string(vertices.size()));
|
||||
},
|
||||
[&](StrokeFrame&, int face_index, std::span<const vertex_t>) {
|
||||
events.emplace_back("execute:" + std::to_string(face_index));
|
||||
return glm::vec4(1.0F, 2.0F, 3.0F, 4.0F);
|
||||
},
|
||||
face_framebuffers);
|
||||
},
|
||||
[&] {
|
||||
events.emplace_back("unbind-textures");
|
||||
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
|
||||
main_pass_texture_unbindings,
|
||||
main_pass_texture_dispatch);
|
||||
},
|
||||
[&] {
|
||||
events.emplace_back("unbind-samplers");
|
||||
}));
|
||||
|
||||
const std::vector<std::string> expected_events {
|
||||
"bind-samplers",
|
||||
"bind-textures",
|
||||
"activate:0",
|
||||
"bind-brush",
|
||||
"activate:1",
|
||||
"bind-destination",
|
||||
"activate:2",
|
||||
"bind-pattern",
|
||||
"activate:3",
|
||||
"bind-mixer",
|
||||
"begin-frame:31",
|
||||
"prepare:2:3",
|
||||
"bind:2",
|
||||
"execute:2",
|
||||
"unbind:2",
|
||||
"unbind-textures",
|
||||
"activate:3",
|
||||
"unbind-mixer",
|
||||
"activate:1",
|
||||
"unbind-destination",
|
||||
"activate:0",
|
||||
"unbind-brush",
|
||||
"unbind-samplers",
|
||||
};
|
||||
|
||||
PP_EXPECT(h, ok);
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
}
|
||||
|
||||
void retained_stroke_pad_face_callbacks_preserve_order(pp::tests::Harness& h)
|
||||
{
|
||||
const std::array<bool, 3> dirty_faces { true, false, true };
|
||||
@@ -1647,16 +1818,28 @@ void retained_stroke_preview_background_capture_preserves_retained_call_order(pp
|
||||
{
|
||||
std::vector<std::string> events;
|
||||
std::array<int, 6> copy_args {};
|
||||
bool copy_ok = false;
|
||||
|
||||
pp::panopainter::execute_legacy_stroke_preview_background_capture(
|
||||
pp::panopainter::execute_legacy_stroke_preview_live_pass(
|
||||
[&]() { events.emplace_back("setup"); },
|
||||
[&]() { events.emplace_back("draw"); },
|
||||
[&]() { events.emplace_back("bind"); },
|
||||
[&](int dst_x, int dst_y, int src_x, int src_y, int width, int height) {
|
||||
events.emplace_back("copy");
|
||||
copy_args = { dst_x, dst_y, src_x, src_y, width, height };
|
||||
[&]() {
|
||||
return std::vector<int> { 0 };
|
||||
},
|
||||
LegacyStrokePreviewCopySize { .width = 48, .height = 32 });
|
||||
[&](int&) {},
|
||||
[&](int&) { events.emplace_back("draw"); },
|
||||
[&](int&) {},
|
||||
[&]() {
|
||||
const auto copy_status = pp::paint_renderer::copy_stroke_preview_result_to_texture(
|
||||
[&]() { events.emplace_back("bind"); },
|
||||
[&](int src_x, int src_y, int dst_x, int dst_y, int width, int height) {
|
||||
events.emplace_back("copy");
|
||||
copy_args = { src_x, src_y, dst_x, dst_y, width, height };
|
||||
},
|
||||
pp::paint_renderer::StrokePreviewCopySize { .width = 48, .height = 32 });
|
||||
PP_EXPECT(h, copy_status.ok());
|
||||
copy_ok = copy_status.ok();
|
||||
});
|
||||
PP_EXPECT(h, copy_ok);
|
||||
|
||||
const std::vector<std::string> expected_events { "setup", "draw", "bind", "copy" };
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
@@ -1692,13 +1875,14 @@ void retained_stroke_preview_texture_copy_binds_before_copy(pp::tests::Harness&
|
||||
std::vector<std::string> events;
|
||||
std::array<int, 6> copy_args {};
|
||||
|
||||
pp::panopainter::copy_legacy_stroke_preview_texture(
|
||||
const auto copy_status = pp::paint_renderer::copy_stroke_preview_result_to_texture(
|
||||
[&]() { events.emplace_back("bind"); },
|
||||
[&](int dst_x, int dst_y, int src_x, int src_y, int width, int height) {
|
||||
[&](int src_x, int src_y, int dst_x, int dst_y, int width, int height) {
|
||||
events.emplace_back("copy");
|
||||
copy_args = { dst_x, dst_y, src_x, src_y, width, height };
|
||||
copy_args = { src_x, src_y, dst_x, dst_y, width, height };
|
||||
},
|
||||
LegacyStrokePreviewCopySize { .width = 96, .height = 64 });
|
||||
pp::paint_renderer::StrokePreviewCopySize { .width = 96, .height = 64 });
|
||||
PP_EXPECT(h, copy_status.ok());
|
||||
|
||||
const std::vector<std::string> expected_events { "bind", "copy" };
|
||||
PP_EXPECT(h, events == expected_events);
|
||||
@@ -2087,6 +2271,9 @@ int main()
|
||||
harness.run(
|
||||
"retained_stroke_main_pass_execution_preserves_bind_and_unbind_order",
|
||||
retained_stroke_main_pass_execution_preserves_bind_and_unbind_order);
|
||||
harness.run(
|
||||
"retained_stroke_main_pass_execution_preserves_destination_binding_order_and_face_execution",
|
||||
retained_stroke_main_pass_execution_preserves_destination_binding_order_and_face_execution);
|
||||
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