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

◆ on_attach()

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

Called when this processor is attached to a buffer.

Parameters
bufferBuffer this processor is being attached to

Provides an opportunity for the processor to initialize buffer-specific state, allocate resources, or perform validation. With expanded processor capabilities, this method can also:

  • Analyze Buffer Characteristics: Examine data type, size, and format requirements
  • Select Optimal Backend: Choose the most appropriate processing backend for the buffer
  • Initialize Hardware Resources: Set up GPU contexts, CUDA streams, or other acceleration
  • Configure Processing Parameters: Adapt algorithm parameters to buffer characteristics
  • Establish Processing Strategy: Determine whether to use sequential or parallel execution
  • Validate Compatibility: Ensure the processor can handle the buffer's data type and format

Default implementation does nothing, but derived classes should override this method to leverage the full capabilities of the expanded processor architecture.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 94 of file TransferProcessor.cpp.

95{
97 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
98 if (!validate_audio_to_gpu(vk_buffer)) {
100 "TransferProcessor not configured for the attached VKBuffer instance (audio→gpu).");
101 return;
102 }
103
104 if (!vk_buffer->is_initialized()) {
106 "VKBuffer not initialized - register with BufferManager first.");
107 return;
108 }
109
110 if (!vk_buffer->is_host_visible()) {
111 auto it = m_staging_map.find(vk_buffer);
112 if (it == m_staging_map.end()) {
114 "No staging buffer configured for device-local VKBuffer. Create one for efficient transfers.");
115 }
116 }
117 } else {
119 std::source_location::current(),
120 "TransferProcessor (audio→gpu) requires VKBuffer attachment");
121 }
122
124 if (auto audio_buffer = std::dynamic_pointer_cast<AudioBuffer>(buffer)) {
125 if (!validate_gpu_to_audio(audio_buffer)) {
127 "TransferProcessor not configured for the attached AudioBuffer instance (gpu→audio).");
128 return;
129 }
130 } else {
132 std::source_location::current(),
133 "TransferProcessor (gpu→audio) requires AudioBuffer attachment");
134 }
135 }
136}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
bool validate_audio_to_gpu(const std::shared_ptr< VKBuffer > &target) const
bool validate_gpu_to_audio(const std::shared_ptr< AudioBuffer > &target) const
std::unordered_map< std::shared_ptr< VKBuffer >, std::shared_ptr< VKBuffer > > m_staging_map
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Buffers::AUDIO_TO_GPU, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::GPU_TO_AUDIO, m_direction, m_staging_map, MF_ERROR, MF_WARN, validate_audio_to_gpu(), and validate_gpu_to_audio().

+ Here is the call graph for this function: