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

BufferProcessor that uploads geometry node data to GPU vertex buffers. More...

#include <GeometryBindingsProcessor.hpp>

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

Classes

struct  GeometryBinding
 Structure representing a geometry binding. More...
 

Public Member Functions

 GeometryBindingsProcessor ()
 
void bind_geometry_node (const std::string &name, const std::shared_ptr< Nodes::GpuSync::GeometryWriterNode > &node, const std::shared_ptr< VKBuffer > &vertex_buffer)
 Bind a geometry node to a GPU vertex buffer.
 
void unbind_geometry_node (const std::string &name)
 Remove a geometry binding.
 
bool has_binding (const std::string &name) const
 Check if a binding exists.
 
std::vector< std::string > get_binding_names () const
 Get all binding names.
 
size_t get_binding_count () const
 Get number of active bindings.
 
std::optional< GeometryBindingget_binding (const std::string &name) const
 Get a specific binding.
 
void processing_function (std::shared_ptr< Buffer > buffer) override
 BufferProcessor interface - uploads all bound geometries.
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 
void process (std::shared_ptr< Buffer > buffer)
 Applies a computational transformation to the data in the provided buffer.
 
virtual void on_attach (std::shared_ptr< Buffer >)
 Called when this processor is attached to a buffer.
 
virtual void on_detach (std::shared_ptr< Buffer >)
 Called when this processor is detached from a buffer.
 
virtual void set_processing_token (ProcessingToken token)
 Gets the preferred processing backend for this processor.
 
virtual ProcessingToken get_processing_token () const
 Gets the current processing token for this buffer.
 
virtual bool is_compatible_with (std::shared_ptr< Buffer >) const
 Checks if this processor can handle the specified buffer type.
 

Private Attributes

std::unordered_map< std::string, GeometryBindingm_bindings
 

Additional Inherited Members

- Protected Member Functions inherited from MayaFlux::Buffers::VKBufferProcessor
void initialize_buffer_service ()
 
void initialize_compute_service ()
 
- 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

BufferProcessor that uploads geometry node data to GPU vertex buffers.

Manages bindings between GeometryWriterNode instances (CPU-side) and GPU vertex buffers. Each frame, reads vertex data from nodes and uploads to corresponding GPU buffers via staging buffers.

Behavior:

  • Uploads ALL bound geometries to their target vertex buffers
  • If target is device-local: uses staging buffer (auto-created)
  • If target is host-visible: direct upload (no staging)
  • If attached buffer is one of the targets: uploads its geometry
  • If attached buffer is NOT a target: uploads first geometry to it

Usage: auto vertex_buffer = std::make_shared<VKBuffer>( 1000 * sizeof(Vertex), VKBuffer::Usage::VERTEX_BUFFER);

auto processor = std::make_shared<GeometryBindingsProcessor>(); processor->bind_geometry_node("particles", particle_node, vertex_buffer);

vertex_buffer->set_default_processor(processor); vertex_buffer->process_default(); // Uploads geometry

Definition at line 37 of file GeometryBindingsProcessor.hpp.


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