|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
ShaderProcessor that reads Forma element state and routes it to push constants or descriptor bindings on external pipelines each graphics tick. More...
#include <FormaBindingsProcessor.hpp>
Inheritance diagram for MayaFlux::Buffers::FormaBindingsProcessor:
Collaboration diagram for MayaFlux::Buffers::FormaBindingsProcessor:Classes | |
| struct | Binding |
| struct | DescriptorTarget |
| struct | PushConstantTarget |
Public Member Functions | |
| void | bind_descriptor (const std::string &name, std::function< float()> reader, const std::string &descriptor_name, uint32_t binding_index, uint32_t set, Portal::Graphics::DescriptorRole role=Portal::Graphics::DescriptorRole::UNIFORM) |
| Bind a type-erased reader to a descriptor binding. | |
| template<typename T > | |
| void | bind_descriptor (const std::string &name, std::shared_ptr< Portal::Forma::MappedState< T > > state, std::function< float(T)> project, const std::string &descriptor_name, uint32_t binding_index, uint32_t set, Portal::Graphics::DescriptorRole role=Portal::Graphics::DescriptorRole::UNIFORM) |
| Bind a MappedState<T> to a descriptor binding on the attached buffer. | |
| void | bind_push_constant (const std::string &name, std::function< float()> reader, uint32_t offset, size_t size=sizeof(float)) |
| Bind a type-erased reader to a push constant slot. | |
| template<typename T > | |
| void | bind_push_constant (const std::string &name, std::shared_ptr< Portal::Forma::MappedState< T > > state, std::function< float(T)> project, uint32_t offset, size_t size=sizeof(float)) |
| Bind a MappedState<T> to a push constant slot on an external ShaderProcessor. | |
| FormaBindingsProcessor (const FormaBindingsProcessor &)=delete | |
| FormaBindingsProcessor (const std::string &shader_path) | |
| FormaBindingsProcessor (FormaBindingsProcessor &&)=delete | |
| FormaBindingsProcessor (ShaderConfig config) | |
| std::vector< std::string > | get_binding_names () const |
| Returns all registered binding names. | |
| bool | has_binding (const std::string &name) const |
Returns true if a binding with name exists. | |
| FormaBindingsProcessor & | operator= (const FormaBindingsProcessor &)=delete |
| FormaBindingsProcessor & | operator= (FormaBindingsProcessor &&)=delete |
| bool | unbind (const std::string &name) |
| Remove a binding by name. | |
| ~FormaBindingsProcessor () override=default | |
Public Member Functions inherited from MayaFlux::Buffers::ShaderProcessor | |
| void | add_binding (const std::string &descriptor_name, const ShaderBinding &binding) |
| Add descriptor binding configuration. | |
| bool | are_bindings_complete () const |
| Check if all required bindings are satisfied. | |
| bool | are_descriptors_ready () const |
| Check if descriptors are initialized. | |
| void | auto_bind_buffer (const std::shared_ptr< VKBuffer > &buffer) |
| Auto-bind buffer based on attachment order. | |
| void | bind_buffer (const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer) |
| Bind a VKBuffer to a named shader descriptor. | |
| void | clear_specialization_constants () |
| Clear all specialization constants. | |
| std::vector< std::string > | get_binding_names () const |
| Get all configured descriptor names. | |
| std::shared_ptr< VKBuffer > | get_bound_buffer (const std::string &descriptor_name) const |
| Get bound buffer for a descriptor name. | |
| size_t | get_bound_buffer_count () const |
| Get number of bound buffers. | |
| virtual BufferUsageHint | get_buffer_usage_hint (const std::string &descriptor_name) const |
| Get buffer usage hint for a descriptor. | |
| const ShaderConfig & | get_config () const |
| Get current configuration. | |
| virtual std::shared_ptr< VKBuffer > | get_output_buffer () const |
| Get the output buffer after compute dispatch. | |
| std::vector< uint8_t > & | get_push_constant_data () |
| const std::vector< uint8_t > & | get_push_constant_data () const |
| Get current push constant data. | |
| const std::string & | get_shader_path () const |
| Get current shader path. | |
| bool | has_binding (const std::string &descriptor_name) const |
| Check if a descriptor binding exists. | |
| virtual bool | has_executed () const |
| Check if compute has been executed at least once. | |
| bool | hot_reload_shader () |
| Hot-reload shader from ShaderFoundry. | |
| bool | is_compatible_with (const std::shared_ptr< Buffer > &buffer) const override |
| Checks if this processor can handle the specified buffer type. | |
| virtual bool | is_in_place_operation (const std::string &descriptor_name) const |
| Check if shader modifies a specific buffer in-place. | |
| bool | is_shader_loaded () const |
| Check if shader is loaded. | |
| 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. | |
| void | set_config (const ShaderConfig &config) |
| Update entire configuration. | |
| template<typename T > | |
| void | set_push_constant_data (const T &data) |
| Update push constant data (type-safe) | |
| virtual void | set_push_constant_data_raw (const void *data, size_t size) |
| Update push constant data (raw bytes) | |
| template<typename T > | |
| void | set_push_constant_size () |
| Set push constant size from type. | |
| void | set_push_constant_size (size_t size) |
| Set push constant size. | |
| void | set_shader (const std::string &shader_path) |
| Update shader path and reload. | |
| void | set_specialization_constant (uint32_t constant_id, uint32_t value) |
| Set specialization constant. | |
| ShaderProcessor (const std::string &shader_path) | |
| Construct processor with shader path. | |
| ShaderProcessor (ShaderConfig config) | |
| Construct processor with full configuration. | |
| void | unbind_buffer (const std::string &descriptor_name) |
| Unbind a buffer from a descriptor. | |
| ~ShaderProcessor () override | |
Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor | |
| virtual ProcessingToken | get_processing_token () const |
| Gets the current processing token for this buffer. | |
| 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 | execute_shader (const std::shared_ptr< VKBuffer > &buffer) override |
| void | initialize_descriptors (const std::shared_ptr< VKBuffer > &) override |
| void | initialize_pipeline (const std::shared_ptr< VKBuffer > &) override |
Protected Member Functions inherited from MayaFlux::Buffers::ShaderProcessor | |
| virtual void | cleanup () |
| virtual void | on_after_execute (Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) |
| Called after each process callback. | |
| virtual void | on_before_compile (const std::string &shader_path) |
| Called before shader compilation. | |
| virtual void | on_before_descriptors_create () |
| Called before descriptor sets are created. | |
| virtual bool | on_before_execute (Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) |
| Called before each process callback. | |
| virtual void | on_before_pipeline_create (Portal::Graphics::ComputePipelineID pipeline_id) |
| Called before pipeline creation. | |
| virtual void | on_descriptors_created () |
| Called after descriptor sets are created. | |
| virtual void | on_pipeline_created (Portal::Graphics::ComputePipelineID pipeline_id) |
| Called after pipeline is created. | |
| virtual void | on_shader_loaded (Portal::Graphics::ShaderID shader_id) |
| Called after shader is loaded. | |
| std::optional< uint32_t > | resolve_ds_index (uint32_t set) const |
| Resolve logical descriptor set index to actual index. | |
| virtual void | update_descriptors (const std::shared_ptr< VKBuffer > &buffer) |
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 Types | |
| enum class | TargetKind : uint8_t { PUSH_CONSTANT , DESCRIPTOR } |
Private Member Functions | |
| void | flush_descriptor (float value, const DescriptorTarget &desc, const std::shared_ptr< VKBuffer > &attached) |
| void | flush_push_constant (float value, const PushConstantTarget &pc, const std::shared_ptr< VKBuffer > &buffer) |
Static Private Member Functions | |
| static std::shared_ptr< VKBuffer > | make_descriptor_buffer (Portal::Graphics::DescriptorRole role) |
Private Attributes | |
| std::unordered_map< std::string, Binding > | m_bindings |
ShaderProcessor that reads Forma element state and routes it to push constants or descriptor bindings on external pipelines each graphics tick.
Attaches to a FormaBuffer as a secondary processor — never as the primary. Owns no pipeline or shader of its own; initialize_pipeline() and initialize_descriptors() are no-ops, matching NodeBindingsProcessor and DescriptorBindingsProcessor.
The processor is the automation layer. Each binding registers:
Templated bind overloads accept any MappedState<T> and a projection function, constructing the type-erased reader internally. The processor itself holds no template parameters.
Usage:
Definition at line 56 of file FormaBindingsProcessor.hpp.