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

Non-template base that owns all type-independent GPU dispatch logic. More...

#include <GpuDispatchCore.hpp>

+ Inheritance diagram for MayaFlux::Yantra::GpuDispatchCore:
+ Collaboration diagram for MayaFlux::Yantra::GpuDispatchCore:

Classes

struct  ImageBinding
 

Public Member Functions

bool ensure_gpu_ready ()
 Ensure GPU resources are initialised.
 
std::shared_ptr< Core::VKImageget_output_image (size_t binding_index) const
 Return the image registered at an IMAGE_STORAGE output binding.
 
 GpuDispatchCore (const GpuDispatchCore &)=delete
 
 GpuDispatchCore (GpuDispatchCore &&)=delete
 
 GpuDispatchCore (GpuShaderConfig config)
 
bool is_gpu_ready () const
 Query GPU readiness without attempting initialisation.
 
GpuDispatchCoreoperator= (const GpuDispatchCore &)=delete
 
GpuDispatchCoreoperator= (GpuDispatchCore &&)=delete
 
template<typename T >
void set_binding_data (size_t index, const std::vector< T > &data)
 
template<typename T >
void set_binding_data (size_t index, std::span< const T > data)
 Pre-stage typed data for a specific binding slot, bypassing the default channel-flattening path in prepare_gpu_inputs.
 
void set_output_size (size_t index, size_t byte_size)
 Declare the byte capacity of an output binding independently of input data.
 
template<typename T >
void set_push_constants (const T &data)
 Typed convenience wrapper for set_push_constants(const void*, size_t).
 
void set_push_constants (const void *data, size_t bytes)
 Set push constant data from a raw byte pointer.
 
virtual ~GpuDispatchCore ()=default
 

Protected Member Functions

virtual std::array< uint32_t, 3 > calculate_dispatch_size (size_t total_elements, const DataStructureInfo &structure_info) const
 Calculate workgroup dispatch counts from structure dimensions.
 
virtual std::vector< GpuBufferBindingdeclare_buffer_bindings () const
 Declare the storage buffers the shader expects.
 
GpuChannelResult dispatch_core (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
 Full single-pass dispatch.
 
GpuChannelResult dispatch_core_chained (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info, const ExecutionContext &ctx)
 Multi-pass (chained) dispatch.
 
size_t find_first_output_index () const
 
void flatten_channels_to_staging (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
 Flatten planar double channels into m_staging_floats.
 
const GpuShaderConfiggpu_config () const
 
size_t largest_binding_data_element_count () const
 
virtual void on_before_gpu_dispatch (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
 Called immediately before dispatch.
 
virtual void prepare_gpu_inputs (const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
 Marshal channel data into GPU input buffers.
 
void readback_aux (GpuChannelResult &result)
 Read back all OUTPUT bindings that have explicit size overrides into the aux map of a GpuChannelResult.
 
std::vector< float > readback_primary (size_t float_count)
 Read back the primary output buffer into a float vector.
 
void stage_image_sampled (size_t binding_index, std::shared_ptr< Core::VKImage > image, vk::Sampler sampler)
 Register a VKImage + sampler for an IMAGE_SAMPLED binding.
 
void stage_image_storage (size_t binding_index, std::shared_ptr< Core::VKImage > image)
 Register a VKImage for an IMAGE_STORAGE binding.
 
void stage_passthrough (size_t binding_index, const void *data, size_t byte_size)
 Stage raw bytes for a PASSTHROUGH binding before dispatch.
 

Protected Attributes

std::vector< std::vector< uint8_t > > m_binding_data
 
std::vector< GpuBufferBindingm_bindings
 
std::vector< ImageBindingm_image_bindings
 
std::vector< size_t > m_output_size_overrides
 
std::vector< std::vector< uint8_t > > m_passthrough_bytes
 
std::vector< uint8_t > m_push_constants
 
GpuResourceManager m_resources
 
std::vector< float > m_staging_floats
 

Private Attributes

GpuShaderConfig m_gpu_config
 

Detailed Description

Non-template base that owns all type-independent GPU dispatch logic.

Separates resource management, buffer staging, and dispatch orchestration from the type-parameterised boundary in GpuExecutionContext. All virtual override points that do not reference InputType/OutputType live here so that implementations can be placed in a .cpp file.

Subclasses (including GpuExecutionContext) implement the two remaining type-dependent steps – channel extraction and output reconstruction – without duplicating anything that is type-independent.

Definition at line 37 of file GpuDispatchCore.hpp.


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