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

◆ flush()

void MayaFlux::Buffers::SliceSet::flush ( const std::shared_ptr< VKBuffer > &  target,
std::shared_ptr< VKBuffer > &  staging 
)

Upload what changed since the last flush.

Parameters
targetDestination buffer, grown here when the mirror outgrew it.
stagingStaging buffer for device-local targets, grown as needed.

Growing discards the target's contents, so a grow uploads the whole mirror.

Definition at line 168 of file SliceSet.cpp.

169{
170 if (!target) {
171 error<std::invalid_argument>(
174 std::source_location::current(),
175 "SliceSet::flush: target buffer is null");
176 }
177
178 const size_t capacity_before = target->get_size_bytes();
179 ensure_gpu_capacity(target, staging, m_mirror.size());
180 if (target->get_size_bytes() != capacity_before) {
181 m_all_dirty = true;
182 }
183
184 if (m_all_dirty) {
185 m_dirty.clear();
186 m_dirty.emplace_back(0, m_mirror.size());
187 m_all_dirty = false;
188 }
189
190 for (auto& [start, end] : m_dirty) {
191 end = std::min(end, m_mirror.size());
192 }
193
194 upload_intervals(m_mirror.data(), m_dirty, target, staging);
195 m_dirty.clear();
196}
std::vector< uint8_t > m_mirror
Definition SliceSet.hpp:117
std::vector< std::pair< size_t, size_t > > m_dirty
Definition SliceSet.hpp:118
void upload_intervals(const void *base, std::span< const std::pair< size_t, size_t > > intervals, const std::shared_ptr< VKBuffer > &target, std::shared_ptr< VKBuffer > &staging)
Upload several byte ranges of one source to the same offsets in target.
void ensure_gpu_capacity(const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging, size_t required, float growth_factor)
Grow a GPU buffer (and its paired staging buffer) to fit required bytes.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::ensure_gpu_capacity(), m_all_dirty, m_dirty, m_mirror, and MayaFlux::Buffers::upload_intervals().

Referenced by MayaFlux::Buffers::FormaProcessor::processing_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: