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

Default processor for FormaBuffer. More...

#include <FormaProcessor.hpp>

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

Classes

struct  PendingTexture
 

Public Types

using SliceId = SliceSet::SliceId
 

Public Member Functions

SliceId add_slice (const std::vector< uint8_t > &bytes, std::optional< Portal::Graphics::PrimitiveTopology > topology=std::nullopt)
 Append a slice, drawn after the existing ones.
 
void bring_slice_to_front (SliceId id)
 Draw a slice after every other.
 
 FormaProcessor (Portal::Graphics::PrimitiveTopology topology)
 
bool has_pending () const noexcept
 True when geometry or slice changes await the next tick.
 
bool has_slice (SliceId id) const noexcept
 True when id names a live slice.
 
void remove_slice (SliceId id)
 Remove a slice; later slices shift down.
 
void send_slice_to_back (SliceId id)
 Draw a slice before every other.
 
void set_bytes (const std::vector< uint8_t > &bytes)
 Replace the default slice with new vertex bytes.
 
void set_slice_visible (SliceId id, bool visible)
 Hide or show a slice without moving its data.
 
void set_texture (std::shared_ptr< Core::VKImage > image, std::string binding)
 Supply a texture to bind on the next graphics tick.
 
size_t slice_count () const noexcept
 Number of live slices.
 
void update_slice (SliceId id, const std::vector< uint8_t > &bytes)
 Replace a slice's vertices; later slices shift if the size changes.
 
 ~FormaProcessor () 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 apply_runs (const std::shared_ptr< VKBuffer > &buffer)
 
std::span< const uint8_t > whole_vertices (const std::vector< uint8_t > &bytes) const noexcept
 

Private Attributes

bool m_changed { false }
 
SliceId m_default_slice { 0 }
 
std::optional< std::vector< Portal::Graphics::DrawRun > > m_pending_runs
 
std::optional< PendingTexture > m_pending_texture
 
SliceSet m_slices
 
std::shared_ptr< VKBuffer > m_staging
 
uint32_t m_stride { 0 }
 
std::atomic_flag m_texture_dirty
 
Portal::Graphics::PrimitiveTopology m_topology
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Buffers::VKBufferProcessor
Registry::Service::BufferService * m_buffer_service = nullptr
 
Registry::Service::ComputeService * m_compute_service = nullptr
 
- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Default processor for FormaBuffer.

Owns the CPU-to-GPU upload cycle for Forma geometry through a SliceSet. Geometry is held as one or more slices of one stride and topology, laid out in a single vertex buffer. set_bytes() writes the default slice, so a standalone buffer is a batch of one. Each graphics tick uploads only what changed, then points the RenderProcessor at the visible slices: one draw per run, adjacent runs coalesced.

The topology is fixed at construction to derive the per-vertex stride.

Slice calls and processing run on the graphics thread; nothing here is synchronised. A trailing partial vertex in submitted bytes is dropped.

Definition at line 25 of file FormaProcessor.hpp.


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