Download each array layer of a Vulkan 2D array image into the corresponding layer slot.
315{
318 "TextureContainer::from_image_array called with uninitialised image");
319 return;
320 }
321
322 const auto n =
static_cast<uint32_t
>(
m_data.size());
323 if (
image->get_array_layers() < n) {
325 "TextureContainer::from_image_array image has {} layers, container expects {}",
326 image->get_array_layers(), n);
327 return;
328 }
329
331 std::vector<uint8_t> combined(layer_bytes * n);
333
335 for (uint32_t i = 0; i < n; ++i) {
338 auto [
ptr, bytes] = variant_bytes_mut(
m_data[i]);
339 if (
ptr && bytes == layer_bytes)
340 std::memcpy(
ptr, combined.data() + i * layer_bytes, layer_bytes);
341
343 }
344
346}
#define MF_ERROR(comp, ctx,...)
std::vector< std::atomic< bool > > m_normalised_dirty
Memory::SeqlockArray m_slot_locks
void update_processing_state(ProcessingState state) override
Update the processing state of the container.
Portal::Graphics::ImageFormat m_format
std::vector< DataVariant > m_data
size_t byte_size() const
Total byte count of the pixel buffer.
void download_data(const std::shared_ptr< Core::VKImage > &image, void *data, size_t size, const std::shared_ptr< Buffers::VKBuffer > &staging, bool deferred=false)
Download pixel data from a VKImage, reusing a caller-supplied persistent staging buffer.
static TextureLoom & instance()
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ READY
Container has data loaded and is ready for processing.