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

Accepts externally-supplied DataVariant and uploads it as vertex data to a VKBuffer each cycle. More...

#include <GeometryWriteProcessor.hpp>

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

Public Member Functions

 GeometryWriteProcessor ()
 
bool has_pending () const noexcept
 Returns true if a snapshot has been set and not yet consumed.
 
void set_config (const Kakshya::VertexAccessConfig &config)
 
void set_data (Kakshya::DataVariant variant)
 Supply vertex data for the next cycle.
 
void set_mode (GeometryWriteMode mode)
 
void set_vertices (const void *data, size_t byte_count, const Kakshya::VertexLayout &layout)
 Supply pre-resolved vertex bytes for the next cycle.
 
 ~GeometryWriteProcessor () 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 Attributes

std::optional< Kakshya::DataVariantm_active_data
 
std::optional< VertexSnapshotm_active_vertices
 
Kakshya::VertexAccessConfig m_config
 
std::atomic_flag m_data_dirty
 
GeometryWriteMode m_mode { GeometryWriteMode::POINT }
 
std::optional< Kakshya::DataVariantm_pending_data
 
std::optional< VertexSnapshotm_pending_vertices
 
std::shared_ptr< VKBufferm_staging
 
std::atomic_flag m_vertices_dirty
 

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

Accepts externally-supplied DataVariant and uploads it as vertex data to a VKBuffer each cycle.

Converts the supplied DataVariant to a vertex representation via Kakshya::as_vertex_access() and uploads the result to the attached VKBuffer. The VertexLayout derived from the conversion is set on the buffer so RenderProcessor has full stride and attribute information.

Dirty gating: upload occurs only when new data has been supplied via set_data() since the last cycle. No stale re-upload.

Thread safety: set_data() and the graphics thread may run concurrently. Lock-free double-buffer swap via atomic_flag ensures the graphics thread never blocks on the supplier thread.

Staging: if the attached VKBuffer is device-local a staging buffer is created automatically on on_attach() and reused every cycle.

Definition at line 47 of file GeometryWriteProcessor.hpp.


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