Add targeted PPI payload automation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "assets/image_metadata.h"
|
||||
#include "foundation/binary_stream.h"
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
@@ -705,19 +706,33 @@ pp::foundation::Result<std::vector<std::byte>> create_minimal_ppi_project(PpiMin
|
||||
}
|
||||
}
|
||||
|
||||
bool seen_faces[6] {};
|
||||
std::vector<std::array<bool, 6>> seen_faces(
|
||||
static_cast<std::size_t>(config.layer_count) * static_cast<std::size_t>(config.frame_count));
|
||||
std::uint64_t total_payload_bytes = 0;
|
||||
for (const auto& face : config.dirty_faces) {
|
||||
if (face.layer_index >= config.layer_count) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI dirty face layer index is outside the layer list"));
|
||||
}
|
||||
|
||||
if (face.frame_index >= config.frame_count) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI dirty face frame index is outside the frame list"));
|
||||
}
|
||||
|
||||
if (face.face_index >= 6U) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI dirty face index is outside the cube face list"));
|
||||
}
|
||||
|
||||
if (seen_faces[face.face_index]) {
|
||||
const auto slot_index =
|
||||
static_cast<std::size_t>(face.layer_index) * static_cast<std::size_t>(config.frame_count)
|
||||
+ static_cast<std::size_t>(face.frame_index);
|
||||
if (seen_faces[slot_index][face.face_index]) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::invalid_argument("PPI dirty face index is duplicated"));
|
||||
pp::foundation::Status::invalid_argument("PPI dirty face slot is duplicated"));
|
||||
}
|
||||
seen_faces[face.face_index] = true;
|
||||
seen_faces[slot_index][face.face_index] = true;
|
||||
|
||||
if (face.width == 0 || face.height == 0) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
@@ -790,12 +805,11 @@ pp::foundation::Result<std::vector<std::byte>> create_minimal_ppi_project(PpiMin
|
||||
append_u32(bytes, config.frame_duration_ms);
|
||||
for (std::uint32_t face = 0; face < 6U; ++face) {
|
||||
const PpiDirtyFacePayloadConfig* dirty_face = nullptr;
|
||||
if (layer == 0U && frame == 0U) {
|
||||
for (const auto& candidate : config.dirty_faces) {
|
||||
if (candidate.face_index == face) {
|
||||
dirty_face = &candidate;
|
||||
break;
|
||||
}
|
||||
for (const auto& candidate : config.dirty_faces) {
|
||||
if (candidate.layer_index == layer && candidate.frame_index == frame
|
||||
&& candidate.face_index == face) {
|
||||
dirty_face = &candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,8 @@ struct PpiDecodedProjectImages {
|
||||
};
|
||||
|
||||
struct PpiDirtyFacePayloadConfig {
|
||||
std::uint32_t layer_index = 0;
|
||||
std::uint32_t frame_index = 0;
|
||||
std::uint32_t face_index = 0;
|
||||
std::uint32_t x = 0;
|
||||
std::uint32_t y = 0;
|
||||
|
||||
Reference in New Issue
Block a user