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

Final processor that executes render operations after all buffer processing. More...

#include <RootGraphicsBuffer.hpp>

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

Public Types

using RenderCallback = std::function< void(const std::shared_ptr< RootGraphicsBuffer > &root)>
 Callback signature for render operations.
 

Public Member Functions

 PresentProcessor (RenderCallback callback)
 Creates a render processor with a callback function.
 
 PresentProcessor ()
 Default constructor (no callback set)
 
 ~PresentProcessor () override=default
 
void processing_function (std::shared_ptr< Buffer > buffer) override
 Executes the render callback.
 
void on_attach (std::shared_ptr< Buffer > buffer) override
 Called when processor is attached to a buffer.
 
void on_detach (std::shared_ptr< Buffer > buffer) override
 Called when processor is detached from a buffer.
 
bool is_compatible_with (std::shared_ptr< Buffer > buffer) const override
 Checks compatibility with a specific buffer type.
 
void set_callback (RenderCallback callback)
 Sets or updates the render callback.
 
bool has_callback () const
 Checks if a callback is configured.
 
void clear_callback ()
 Clears the current callback.
 
- 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 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.
 

Private Member Functions

void fallback_renderer (const std::shared_ptr< RootGraphicsBuffer > &root)
 

Private Attributes

RenderCallback m_callback
 User-provided render callback.
 
std::shared_ptr< RootGraphicsBufferm_root_buffer
 Reference to root buffer (for validation and callbacks)
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Final processor that executes render operations after all buffer processing.

PresentProcessor is designed to be set as the final processor of RootGraphicsBuffer. It's invoked after all child buffer processing chains have completed, making it the ideal point to:

  • Record render commands using processed GPU buffers
  • Coordinate rendering operations across multiple buffers
  • Submit command buffers to GPU queues
  • Present frames to the swapchain

Design Philosophy:

  • Callback-based for maximum flexibility
  • Receives RootGraphicsBuffer with all processed child buffers
  • No assumptions about rendering strategy (forward, deferred, etc.)
  • Can query buffers by usage type for organized rendering

Usage Pattern:

auto render_proc = std::make_shared<PresentProcessor>(
[this](RootGraphicsBuffer* root) {
// All buffers processed, ready for rendering
auto vertex_bufs = root->get_buffers_by_usage(VKBuffer::Usage::VERTEX);
auto uniform_bufs = root->get_buffers_by_usage(VKBuffer::Usage::UNIFORM);
// Record render commands
record_render_pass(vertex_bufs, uniform_bufs);
// Submit and present
submit_graphics_queue();
present_frame();
}
);
root_graphics_buffer->set_final_processor(render_proc);
std::vector< std::shared_ptr< VKBuffer > > get_buffers_by_usage(VKBuffer::Usage usage) const
Gets buffers filtered by usage type.
Root container for GPU buffer lifecycle management and batch processing.
@ UNIFORM
Uniform buffer (host-visible when requested)

Token Compatibility:

  • Primary Token: GRAPHICS_BACKEND
  • Executes at frame rate (after all GPU buffer processing)
  • Should NOT perform heavy CPU computations (rendering coordination only)

Definition at line 319 of file RootGraphicsBuffer.hpp.


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