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

◆ on_attach()

void MayaFlux::Buffers::MeshNetworkProcessor::on_attach ( const std::shared_ptr< Buffer > &  )
overrideprotectedvirtual

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 24 of file MeshNetworkProcessor.cpp.

25{
26 if (!m_network || m_network->slot_count() == 0) {
28 "MeshNetworkProcessor attached to empty network");
29 return;
30 }
31
32 auto vk_buf = std::dynamic_pointer_cast<VKBuffer>(buffer);
33 if (!vk_buf) {
35 "MeshNetworkProcessor: attached buffer is not a VKBuffer");
36 return;
37 }
38
39 m_network->ensure_sorted();
40
41 ensure_initialized(vk_buf);
42
44 upload_combined(vk_buf);
47
49 "MeshNetworkProcessor: initialised — {} slots, {} bytes vertex, {} indices",
50 m_network->slot_count(),
51 m_vertex_aggregate.size(),
52 m_index_aggregate.size());
53}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::vector< uint8_t > m_vertex_aggregate
Aggregate scratch buffers reused each cycle to avoid allocation.
void link_index_resources(const std::shared_ptr< VKBuffer > &vertex_buf)
void upload_combined(const std::shared_ptr< VKBuffer > &vertex_buf)
void allocate_gpu_buffers(const std::shared_ptr< VKBuffer > &vertex_buf)
std::shared_ptr< Nodes::Network::MeshNetwork > m_network
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:462
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References allocate_gpu_buffers(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, clear_slot_dirty_flags(), MayaFlux::Buffers::VKBufferProcessor::ensure_initialized(), link_index_resources(), m_index_aggregate, m_network, m_vertex_aggregate, MF_ERROR, MF_INFO, MF_WARN, and upload_combined().

+ Here is the call graph for this function: