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

◆ on_detach()

void MayaFlux::Buffers::TransferProcessor::on_detach ( std::shared_ptr< Buffer )
overridevirtual

Called when this processor is detached from a buffer.

Parameters
bufferBuffer this processor is being detached from

Provides an opportunity for the processor to clean up buffer-specific state or release resources. With expanded processor capabilities, this method should also:

  • Release Hardware Resources: Clean up GPU memory, CUDA contexts, or other acceleration resources
  • Finalize Backend Operations: Ensure all pending backend operations are completed
  • Reset Processing State: Clear any buffer-specific optimization parameters or cached data
  • Restore Default Backend: Return to default processing backend if override was applied
  • Synchronize Operations: Ensure all parallel processing operations have completed

Default implementation does nothing, but proper resource management in derived classes is crucial for optimal performance and preventing resource leaks.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 138 of file TransferProcessor.cpp.

139{
141 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
142 m_staging_map.erase(vk_buffer);
143 for (auto it = m_audio_to_gpu_map.begin(); it != m_audio_to_gpu_map.end();) {
144 if (it->second == vk_buffer) {
145 it = m_audio_to_gpu_map.erase(it);
146 } else {
147 ++it;
148 }
149 }
150 }
152 if (auto audio_buffer = std::dynamic_pointer_cast<AudioBuffer>(buffer)) {
153 for (auto it = m_gpu_to_audio_map.begin(); it != m_gpu_to_audio_map.end();) {
154 if (it->second == audio_buffer) {
155 it = m_gpu_to_audio_map.erase(it);
156 } else {
157 ++it;
158 }
159 }
160 }
161 }
162}
std::unordered_map< std::shared_ptr< VKBuffer >, std::shared_ptr< AudioBuffer > > m_gpu_to_audio_map
std::unordered_map< std::shared_ptr< VKBuffer >, std::shared_ptr< VKBuffer > > m_staging_map
std::unordered_map< std::shared_ptr< AudioBuffer >, std::shared_ptr< VKBuffer > > m_audio_to_gpu_map

References MayaFlux::Buffers::AUDIO_TO_GPU, MayaFlux::Buffers::GPU_TO_AUDIO, m_audio_to_gpu_map, m_direction, m_gpu_to_audio_map, and m_staging_map.