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

◆ on_after_execute()

void MayaFlux::Buffers::RelaxationStepProcessor::on_after_execute ( Portal::Graphics::CommandBufferID  cmd_id,
const std::shared_ptr< VKBuffer > &  buffer 
)
overrideprotectedvirtual

Swap front/back generation index and, if requested, snapshot the newly-front state buffer via a direct host-visible read.

Parameters
cmd_idCommand buffer the completed dispatch was recorded into.
bufferThe attached RelaxationGridBuffer, received as VKBuffer.

Reimplemented from MayaFlux::Buffers::ShaderProcessor.

Definition at line 109 of file RelaxationStepProcessor.cpp.

112{
113 auto grid = std::dynamic_pointer_cast<RelaxationGridBuffer>(buffer);
114 if (!grid) {
115 return;
116 }
117
118 grid->swap_generation();
119
120 if (!grid->consume_snapshot_request()) {
121 return;
122 }
123
124 const auto& front = grid->get_buffer_resources().back_buffers[grid->front_index()];
125
126 std::vector<uint8_t> bytes(grid->get_state_bytes());
127 download_back_buffer(front, bytes.data(), bytes.size(), m_snapshot_staging);
128
129 grid->snapshot_source()->signal(bytes);
130}
std::shared_ptr< VKBuffer > m_snapshot_staging
Fallback staging buffer for download_back_buffer, unused while back_buffers stays HostVisible | HostC...
void download_back_buffer(const VKBufferResources::GenerationSlot &slot, void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Download a raw back_buffers slot to host memory.

References MayaFlux::Buffers::download_back_buffer(), and m_snapshot_staging.

+ Here is the call graph for this function: