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

Uploads concatenated vertex and index data from all MeshNetwork slots. More...

#include <MeshNetworkProcessor.hpp>

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

Public Member Functions

 MeshNetworkProcessor (std::shared_ptr< Nodes::Network::MeshNetwork > network)
 
 ~MeshNetworkProcessor () 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< VKBuffer > &vertex_buf)
 
void allocate_ssbo_buffers ()
 
bool any_slot_dirty () const
 
void clear_slot_dirty_flags ()
 
void link_index_resources (const std::shared_ptr< VKBuffer > &vertex_buf)
 
void push_ssbo_bindings (const std::shared_ptr< VKBuffer > &buffer)
 
size_t total_index_count () const
 
size_t total_vertex_bytes () const
 
void upload_combined (const std::shared_ptr< VKBuffer > &vertex_buf)
 
void upload_ssbos ()
 

Private Attributes

std::shared_ptr< VKBufferm_gpu_index_buffer
 
std::vector< uint32_t > m_index_aggregate
 
std::shared_ptr< VKBufferm_index_staging
 
std::vector< glm::mat4 > m_model_aggregate
 CPU-side scratch for model matrices, reused each cycle.
 
std::shared_ptr< VKBufferm_model_ssbo
 Per-slot world matrices in sorted_indices order. One mat4 per slot.
 
std::shared_ptr< Nodes::Network::MeshNetworkm_network
 
std::vector< uint32_t > m_slot_index_aggregate
 CPU-side scratch for per-vertex slot indices, reused each cycle.
 
std::shared_ptr< VKBufferm_slot_index_ssbo
 Per-vertex slot index. One uint32_t per concatenated vertex.
 
std::vector< uint8_t > m_vertex_aggregate
 Aggregate scratch buffers reused each cycle to avoid allocation.
 
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

Uploads concatenated vertex and index data from all MeshNetwork slots.

Mirrors MeshProcessor but operates over the full slot list of a MeshNetwork rather than a single MeshBuffer. Each cycle:

  1. Checks whether any slot is dirty (slot.dirty || node->needs_gpu_update()). If nothing is dirty the processor is a no-op.
  2. Concatenates vertex bytes from all slots in topological order into a single aggregate vertex staging buffer.
  3. Concatenates index data with each slot's indices rebased by the running vertex count so all slots share one index buffer and one draw call.
  4. Uploads both streams to their respective GPU buffers via staging.
  5. Calls set_index_resources() on the vertex VKBuffer to link the index handle so RenderProcessor can issue an indexed draw.
  6. Clears dirty flags on all uploaded slots and their nodes.

The attached VKBuffer (Usage::VERTEX) is the combined vertex buffer. A separate Usage::INDEX VKBuffer is owned by this processor and sized to fit the total index count across all slots.

Partial-range re-upload (dirty slots only) is deferred. Any dirty slot triggers a full re-concatenation, which is correct and cheap for moderate slot counts.

Definition at line 37 of file MeshNetworkProcessor.hpp.


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