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

Uploads TextureNode pixel data to GPU textures via TextureLoom. More...

#include <NodeTextureProcessor.hpp>

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

Classes

struct  TextureBinding
 Represents a TextureNode → GPU texture binding. More...
 

Public Member Functions

 NodeTextureProcessor ()
 
 ~NodeTextureProcessor () override=default
 
void bind_texture_node (const std::string &name, const std::shared_ptr< Nodes::GpuSync::TextureNode > &node, const std::shared_ptr< Core::VKImage > &texture)
 Bind a TextureNode to a GPU texture.
 
void unbind_texture_node (const std::string &name)
 Remove a texture binding.
 
bool has_binding (const std::string &name) const
 Check if a binding exists.
 
std::vector< std::string > get_binding_names () const
 Get all binding names.
 
size_t get_binding_count () const
 Get number of active bindings.
 
std::optional< TextureBindingget_binding (const std::string &name) const
 Get a specific binding.
 
void processing_function (const std::shared_ptr< Buffer > &buffer) override
 Process all texture uploads.
 
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.
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 
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 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.
 

Private Member Functions

void initialize_gpu_resources ()
 

Private Attributes

std::unordered_map< std::string, TextureBindingm_bindings
 
std::shared_ptr< NodeTextureBufferm_attached_buffer
 

Additional Inherited Members

- Protected Member Functions inherited from MayaFlux::Buffers::VKBufferProcessor
void initialize_buffer_service ()
 
void initialize_compute_service ()
 
- 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 TextureNode pixel data to GPU textures via TextureLoom.

Manages one or more TextureNode → VKImage bindings. Each processing cycle:

  1. Checks if node->needs_gpu_update()
  2. Retrieves pixel data from node->get_pixel_buffer()
  3. Uploads directly to GPU texture via TextureLoom
  4. Clears node's dirty flag

Philosophy:

  • Nodes generate pixels (CPU algorithms)
  • Processor orchestrates upload (delegates to TextureLoom)
  • Textures are VKImages, not VKBuffers
  • TextureLoom handles all staging buffer logistics internally
  • Multiple node→texture bindings share upload infrastructure

Usage (single binding - typical): auto buffer = std::make_shared<NodeTextureBuffer>(node, "noise"); buffer->setup_processors(Graphics); // Processor automatically created and bound

Usage (multiple bindings - advanced): auto staging = std::make_shared<NodeTextureBuffer>(primary_node); auto processor = staging->get_texture_processor();

processor->bind_texture_node("secondary", secondary_node, secondary_texture); processor->bind_texture_node("tertiary", tertiary_node, tertiary_texture);

staging->process_default(); // Uploads all three textures

Definition at line 48 of file NodeTextureProcessor.hpp.


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