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

◆ on_attach()

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

261{
262 auto vk = std::dynamic_pointer_cast<VKBuffer>(buffer);
263 if (!vk) {
264 error<std::invalid_argument>(
267 std::source_location::current(),
268 "DataWriteProcessor requires a VKBuffer");
269 }
270
271 m_modality = vk->get_modality();
272 m_topology = vk->get_render_config().topology;
273
274 if (!vk->is_host_visible()) {
275 m_staging = create_staging_buffer(vk->get_size_bytes());
276 }
277
280 vk->set_vertex_layout(Kakshya::VertexLayout::for_raw());
281 } else {
282 switch (m_topology) {
285 vk->set_vertex_layout(Kakshya::VertexLayout::for_lines());
286 break;
289 vk->set_vertex_layout(Kakshya::VertexLayout::for_meshes());
290 break;
291 default:
292 vk->set_vertex_layout(Kakshya::VertexLayout::for_points());
293 break;
294 }
295 }
296 }
297
299 "DataWriteProcessor attached (modality: {}, staging: {})",
301 m_staging ? "yes" : "no");
302}
#define MF_DEBUG(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
static bool is_vertex_modality(Kakshya::DataModality m) noexcept
Portal::Graphics::PrimitiveTopology m_topology
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
@ VERTICES_3D
3D vertex data (positions, normals, etc.)
std::string_view modality_to_string(DataModality modality)
Convert DataModality enum to string representation.
Definition NDData.cpp:102
static VertexLayout for_raw(uint32_t stride=60)
Factory: layout for raw vertex data with common attributes.
static VertexLayout for_lines(uint32_t stride=60)
Factory: layout for LineVertex (position, color, thickness, uv, normal, tangent)
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
static VertexLayout for_points(uint32_t stride=60)
Factory: layout for PointVertex (position, color, size, uv, normal, tangent)

References buffer, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_staging_buffer(), MayaFlux::Kakshya::VertexLayout::for_lines(), MayaFlux::Kakshya::VertexLayout::for_meshes(), MayaFlux::Kakshya::VertexLayout::for_points(), MayaFlux::Kakshya::VertexLayout::for_raw(), is_vertex_modality(), MayaFlux::Portal::Graphics::LINE_LIST, MayaFlux::Portal::Graphics::LINE_STRIP, m_modality, m_staging, m_topology, MF_DEBUG, MayaFlux::Kakshya::modality_to_string(), MayaFlux::Portal::Graphics::TRIANGLE_LIST, MayaFlux::Portal::Graphics::TRIANGLE_STRIP, and MayaFlux::Kakshya::VERTICES_3D.

+ Here is the call graph for this function: