MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::MeshProcessor Class Reference

Default processor for MeshBuffer: handles CPU-to-GPU upload of vertex and index data with selective dirty-flag re-upload. More...

#include <MeshProcessor.hpp>

+ Inheritance diagram for MayaFlux::Buffers::MeshProcessor:
+ Collaboration diagram for MayaFlux::Buffers::MeshProcessor:

Public Member Functions

 MeshProcessor ()
 
 ~MeshProcessor () override=default
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ProcessingToken get_processing_token () const
 Gets the current processing token for this buffer.
 
virtual bool is_compatible_with (const std::shared_ptr< Buffer > &) const
 Checks if this processor can handle the specified buffer type.
 
void process (const std::shared_ptr< Buffer > &buffer)
 Applies a computational transformation to the data in the provided buffer.
 
virtual void set_processing_token (ProcessingToken token)
 Gets the preferred processing backend for this processor.
 
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Protected Member Functions

void on_attach (const std::shared_ptr< Buffer > &buffer) override
 Called when this processor is attached to a buffer.
 
void on_detach (const std::shared_ptr< Buffer > &buffer) override
 Called when this processor is detached from a buffer.
 
void processing_function (const std::shared_ptr< Buffer > &buffer) override
 The core processing function that must be implemented by derived classes.
 
- Protected Member Functions inherited from MayaFlux::Buffers::VKBufferProcessor
void ensure_initialized (const std::shared_ptr< VKBuffer > &buffer)
 
void initialize_buffer_service ()
 
void initialize_compute_service ()
 

Private Member Functions

void allocate_gpu_buffers (const std::shared_ptr< MeshBuffer > &buf)
 
void link_index_resources ()
 
void upload_indices (const std::shared_ptr< MeshBuffer > &buf)
 
void upload_vertices (const std::shared_ptr< MeshBuffer > &buf)
 

Private Attributes

std::shared_ptr< VKBufferm_gpu_index_buffer
 
std::shared_ptr< VKBufferm_index_staging
 
std::shared_ptr< MeshBufferm_mesh_buffer
 
std::shared_ptr< VKBufferm_vertex_staging
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Buffers::VKBufferProcessor
Registry::Service::BufferServicem_buffer_service = nullptr
 
Registry::Service::ComputeServicem_compute_service = nullptr
 
- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Default processor for MeshBuffer: handles CPU-to-GPU upload of vertex and index data with selective dirty-flag re-upload.

On on_attach: allocates both GPU buffers (VERTEX + INDEX), creates staging buffers, performs the initial upload of both streams, and calls set_index_resources() on the vertex buffer to link the two Vulkan handles in VKBufferResources. This mirrors GeometryBindingsProcessor::bind_geometry_node() but is driven directly from MeshBuffer's MeshData rather than from a node.

On processing_function: checks MeshBuffer::m_vertices_dirty and MeshBuffer::m_indices_dirty independently. Re-uploads whichever stream has changed and clears the flag. No-op when both are clean, so the per-frame cost when a mesh is static is a single atomic load per flag.

Users never instantiate this directly. MeshBuffer creates and sets it as its default processor inside setup_processors().

Deformation path: call MeshBuffer::set_vertex_data() or MeshBuffer::set_index_data(), which set the respective dirty flag. MeshProcessor picks up the change on the next graphics cycle.

Definition at line 32 of file MeshProcessor.hpp.


The documentation for this class was generated from the following files: