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

◆ on_attach()

void MayaFlux::Buffers::InstanceSSBOProcessor::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 22 of file InstanceSSBOProcessor.cpp.

23{
24 if (!m_network || m_network->slot_count() == 0) {
26 "InstanceSSBOProcessor attached to empty network");
27 return;
28 }
29
30 auto vk_buf = std::dynamic_pointer_cast<VKBuffer>(buffer);
31 if (!vk_buf) {
33 "InstanceSSBOProcessor: attached buffer is not a VKBuffer");
34 return;
35 }
36
37 ensure_initialized(vk_buf);
38
39 const size_t slot_count = m_network->slot_count();
40
41 m_vertex_staging = create_staging_buffer(vk_buf->get_size_bytes());
42
43 const size_t ssbo_bytes = slot_count * sizeof(glm::mat4);
44 m_transform_ssbo = std::make_shared<VKBuffer>(
47
49
50 upload_template(vk_buf);
51 upload_transforms(vk_buf);
52 push_ssbo_binding(vk_buf);
53
55 "InstanceSSBOProcessor: {} slots, {} bytes template, {} bytes SSBO",
56 slot_count, vk_buf->get_size_bytes(), ssbo_bytes);
57}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void push_ssbo_binding(const std::shared_ptr< VKBuffer > &vertex_buf)
std::shared_ptr< Nodes::Network::InstanceNetwork > m_network
void upload_transforms(const std::shared_ptr< VKBuffer > &vertex_buf)
void upload_template(const std::shared_ptr< VKBuffer > &vertex_buf)
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:471
@ COMPUTE
Storage buffer for compute shaders (device-local)
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Init
Engine/subsystem initialization.
@ Buffers
Buffers, Managers, processors and processing chains.
@ UNKNOWN
Unknown or undefined modality.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::VKBuffer::COMPUTE, MayaFlux::Buffers::create_staging_buffer(), MayaFlux::Buffers::VKBufferProcessor::ensure_initialized(), MayaFlux::Journal::Init, m_network, m_transform_ssbo, m_transform_staging, m_vertex_staging, MF_ERROR, MF_INFO, MF_WARN, push_ssbo_binding(), MayaFlux::Kakshya::UNKNOWN, upload_template(), and upload_transforms().

+ Here is the call graph for this function: