410{
411 const auto n =
static_cast<uint32_t
>(
m_data.size());
412 if (n == 0)
413 return nullptr;
414
415 if (n == 1)
417
419
421 std::vector<uint8_t> combined(layer_bytes * n);
422 for (uint32_t i = 0; i < n; ++i) {
423 bool valid = false;
426 valid =
ptr && bytes == layer_bytes;
427 if (valid)
428 std::memcpy(combined.data() + i * layer_bytes,
ptr, layer_bytes);
429 });
430 if (!copied || !valid) {
432 "TextureContainer::to_image_array layer {} has invalid pixel data", i);
433 return nullptr;
434 }
435 }
436
437 const Portal::Graphics::ImageKey key {
439 };
443}
#define MF_ERROR(comp, ctx,...)
Memory::SeqlockArray m_slot_locks
std::shared_ptr< Core::VKImage > cached_layer_image(uint32_t layer, const std::shared_ptr< Buffers::VKBuffer > &staging) const
std::vector< DataVariant > m_data
void ensure_cpu_all() const
size_t byte_size() const
Total byte count of the pixel buffer.
Memory::Seqlock m_image_cache_lock
Portal::Graphics::ImageCacheEntry m_array_image_cache
std::shared_ptr< Core::VKImage > refresh_cached_image(ImageCacheEntry &entry, const ImageKey &key, std::span< const uint8_t > pixels, const std::shared_ptr< Buffers::VKBuffer > &staging={})
Refresh a sampled image in an owner-held cache entry.
static TextureLoom & instance()
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
std::pair< const uint8_t *, size_t > variant_bytes(const DataVariant &v)
Get a pointer to the raw bytes of a DataVariant and its size.
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.