MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ set_pixels() [3/3]

void MayaFlux::Kakshya::TextureContainer::set_pixels ( std::span< const uint8_t >  data,
uint32_t  layer = 0 
)

Replace the layer's pixel buffer with a byte source.

Valid only when the declared format is uint8-backed. Size must equal width * height * bytes_per_pixel.

Definition at line 554 of file TextureContainer.cpp.

555{
556 if (layer >= m_data.size()) {
558 "TextureContainer::set_pixels(u8) layer {} out of range", layer);
559 return;
560 }
561 claim_cpu(layer);
562 auto* buf = std::get_if<std::vector<uint8_t>>(&m_data[layer]);
563 if (!buf) {
565 "TextureContainer::set_pixels(u8) called on non-uint8 format {}",
566 static_cast<int>(m_format));
567 return;
568 }
569 if (data.size() != buf->size()) {
571 "TextureContainer::set_pixels(u8) size mismatch: got {} expected {}",
572 data.size(), buf->size());
573 return;
574 }
575
576 Memory::SeqlockWriteGuard g(m_slot_locks[layer]);
577 std::ranges::copy(data, buf->begin());
578 m_normalised_dirty[layer].store(true, std::memory_order_release);
579}
#define MF_ERROR(comp, ctx,...)
std::vector< std::atomic< bool > > m_normalised_dirty
void claim_cpu(uint32_t layer)
Give a GPU-held layer fresh CPU storage before a full overwrite.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References claim_cpu(), MayaFlux::Journal::ContainerProcessing, MayaFlux::Journal::Kakshya, m_data, m_format, m_normalised_dirty, m_slot_locks, and MF_ERROR.

+ Here is the call graph for this function: