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

◆ on_attach()

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

119{
121
122 auto vk_buf = std::dynamic_pointer_cast<VKBuffer>(buffer);
123 if (!vk_buf) {
125 "SDFMeshProcessor requires a VKBuffer");
126 return;
127 }
128
129 if (m_owns_buffers)
131
132 bind_buffer("sdf_grid", m_grid_buf);
133 bind_buffer("edge_table", m_edge_buf);
134 bind_buffer("tri_table", m_tri_buf);
135 bind_buffer("vertices", vk_buf);
136 bind_buffer("counter", m_counter_buf);
137}
#define MF_ERROR(comp, ctx,...)
virtual void on_attach(const std::shared_ptr< Buffer > &)
Called when this processor is attached to a buffer.
std::shared_ptr< VKBuffer > m_grid_buf
bool m_owns_buffers
false in GPU-field mode; buffers owned by SdfPrepProcessor.
std::shared_ptr< VKBuffer > m_tri_buf
std::shared_ptr< VKBuffer > m_counter_buf
std::shared_ptr< VKBuffer > m_edge_buf
void bind_buffer(const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer)
Bind a VKBuffer to a named shader descriptor.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Buffers::ShaderProcessor::bind_buffer(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_counter_buf, m_edge_buf, m_grid_buf, m_owns_buffers, m_tri_buf, MF_ERROR, MayaFlux::Buffers::BufferProcessor::on_attach(), and rebuild_owned_buffers().

+ Here is the call graph for this function: