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

Uploads template geometry once and packs per-slot mat4 transforms into an SSBO each frame for a single instanced draw call. More...

#include <InstanceSSBOProcessor.hpp>

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

Public Member Functions

std::shared_ptr< VKBufferget_transform_ssbo () const
 
 InstanceSSBOProcessor (std::shared_ptr< Nodes::Network::InstanceNetwork > network)
 
 ~InstanceSSBOProcessor () 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

bool any_slot_dirty () const
 
void clear_dirty_flags ()
 
void push_ssbo_binding (const std::shared_ptr< VKBuffer > &vertex_buf)
 
void upload_template (const std::shared_ptr< VKBuffer > &vertex_buf)
 
void upload_transforms (const std::shared_ptr< VKBuffer > &vertex_buf)
 

Private Attributes

std::shared_ptr< Nodes::Network::InstanceNetworkm_network
 
std::vector< glm::mat4 > m_transform_scratch
 
std::shared_ptr< VKBufferm_transform_ssbo
 
std::shared_ptr< VKBufferm_transform_staging
 
std::shared_ptr< VKBufferm_vertex_staging
 

Static Private Attributes

static constexpr uint32_t k_transform_ssbo_binding = 1
 

Friends

class InstanceNetworkBuffer
 

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 template geometry once and packs per-slot mat4 transforms into an SSBO each frame for a single instanced draw call.

Template vertex data is taken from slot 0's node. It is uploaded on on_attach and on any cycle where slot 0 reports needs_gpu_update(). If all slots share the same node this covers the shared template. If slots carry distinct nodes the vertex buffer holds slot 0's geometry only; callers are responsible for ensuring node topology is consistent across slots.

Per-instance SSBO is written every cycle that any slot is dirty. RenderProcessor instance_count is set to network->slot_count() after each SSBO write.

SSBO layout (one entry per slot, tightly packed): binding k_transform_ssbo_binding - mat4 transform[slot_count]

The shader reads gl_InstanceIndex to index into the transform array.

Definition at line 33 of file InstanceSSBOProcessor.hpp.


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