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

◆ on_attach()

void MayaFlux::Buffers::RenderProcessor::on_attach ( const 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 642 of file RenderProcessor.cpp.

643{
644 auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer);
645 if (!vk_buffer)
646 return;
647
649 "RenderProcessor attached to VKBuffer (size: {} bytes, modality: {})",
650 vk_buffer->get_size_bytes(),
651 static_cast<int>(vk_buffer->get_modality()));
652
653 if (vk_buffer && vk_buffer->has_vertex_layout()) {
654 auto vertex_layout = vk_buffer->get_vertex_layout();
655 if (vertex_layout.has_value()) {
657 "RenderProcessor: Auto-injecting vertex layout "
658 "({} vertices, {} attributes)",
659 vertex_layout->vertex_count,
660 vertex_layout->attributes.size());
661
663 m_buffer_info[vk_buffer] = { .semantic_layout = vertex_layout.value(), .use_reflection = false };
664 }
665 }
666
667 if (m_depth_enabled) {
668 vk_buffer->set_needs_depth_attachment(true);
669 }
670
671 if (!m_display_service) {
673 .get_service<Registry::Service::DisplayService>();
674 }
675}
#define MF_INFO(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< std::shared_ptr< VKBuffer >, VertexInfo > m_buffer_info
Registry::Service::DisplayService * m_display_service
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Registry::BackendRegistry::instance(), m_buffer_info, m_depth_enabled, m_display_service, MayaFlux::Buffers::ShaderProcessor::m_needs_pipeline_rebuild, MF_DEBUG, and MF_INFO.

+ Here is the call graph for this function: