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

Encapsulates all Vulkan resource lifecycle behind Portal facades. More...

#include <GpuResourceManager.hpp>

+ Collaboration diagram for MayaFlux::Yantra::GpuResourceManager:

Classes

struct  ImageBind
 One image slot for bind_images_batch: a storage image entry leaves sampler null. More...
 
struct  PipelineUnit
 
struct  SharedBuffers
 

Public Member Functions

void bind_descriptor (const std::string &key, size_t index, const GpuBufferBinding &spec)
 
void bind_descriptors_batch (const std::string &key, const std::vector< GpuBufferBinding > &bindings)
 Bind every non-image buffer binding in one Vulkan call.
 
void bind_image_sampled (const std::string &key, size_t index, const std::shared_ptr< Core::VKImage > &image, vk::Sampler sampler, const GpuBufferBinding &spec)
 Bind a combined image+sampler descriptor at the given slot index.
 
void bind_image_storage (const std::string &key, size_t index, const std::shared_ptr< Core::VKImage > &image, const GpuBufferBinding &spec)
 Bind a storage image descriptor at the given slot index.
 
void bind_images_batch (const std::string &key, const std::vector< ImageBind > &images)
 Bind every image in one Vulkan call.
 
void bind_shared_descriptor (const std::string &key, uint32_t set, size_t binding_index, const GpuBufferBinding &spec)
 
size_t buffer_allocated_bytes (const std::string &key, size_t index) const
 
void cleanup ()
 Destroy every key currently held.
 
void dispatch (const std::string &key, const std::array< uint32_t, 3 > &groups, const std::vector< GpuBufferBinding > &bindings, const uint8_t *push_constant_data, size_t push_constant_size)
 
Portal::Graphics::FenceID dispatch_async (const std::string &key, const std::array< uint32_t, 3 > &groups, const std::vector< GpuBufferBinding > &bindings, const uint8_t *push_constant_data, size_t push_constant_size)
 Submit a compute dispatch without blocking.
 
void dispatch_batched (const std::string &key, const std::array< uint32_t, 3 > &groups, const std::vector< GpuBufferBinding > &bindings, size_t push_constant_size, const ExecutionContext &ctx)
 
void dispatch_batched_indirect (const std::string &key, uint32_t indirect_set, size_t indirect_binding, const std::array< uint32_t, 3 > &groups, const std::vector< GpuBufferBinding > &bindings, size_t push_constant_size, const ExecutionContext &ctx)
 
void dispatch_sequence (const std::vector< std::string > &keys, const std::vector< std::array< uint32_t, 3 > > &groups_per_key, const std::vector< std::vector< uint8_t > > &push_constants_per_key, const std::vector< std::vector< Portal::Graphics::HazardResource > > &hazards_per_key, const std::vector< Portal::Graphics::IndirectDispatch > &indirect_per_key={})
 Record a dispatch for each requested key into one command buffer via ComputePress::record_sequence, submitted once.
 
Portal::Graphics::FenceID dispatch_sequence_async (const std::vector< std::string > &keys, const std::vector< std::array< uint32_t, 3 > > &groups_per_key, const std::vector< std::vector< uint8_t > > &push_constants_per_key, const std::vector< std::vector< Portal::Graphics::HazardResource > > &hazards_per_key, const std::vector< Portal::Graphics::IndirectDispatch > &indirect_per_key={})
 Non-blocking counterpart of dispatch_sequence.
 
void download (const std::string &key, size_t index, float *dest, size_t byte_size)
 
void download_shared (uint32_t set, size_t binding_index, void *dest, size_t byte_size)
 
void ensure_buffer (const std::string &key, size_t index, size_t required_bytes, Portal::Graphics::BufferUsageHint usage_hint=Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE)
 
void ensure_shared_buffer (uint32_t set, size_t binding_index, size_t element_count, GpuBufferBinding::ElementType element_type, Portal::Graphics::BufferUsageHint usage_hint=Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE)
 
 GpuResourceManager ()
 
 GpuResourceManager (const GpuResourceManager &)=delete
 
 GpuResourceManager (GpuResourceManager &&)=delete
 
bool initialise (const std::string &key, const GpuComputeConfig &config, const std::vector< GpuBufferBinding > &bindings)
 Create (or confirm existing) pipeline for the given key.
 
bool is_ready (const std::string &key) const
 
Portal::Graphics::HazardResource make_shared_buffer_hazard (const GpuBufferBinding &spec) const
 
GpuResourceManager & operator= (const GpuResourceManager &)=delete
 
GpuResourceManager & operator= (GpuResourceManager &&)=delete
 
void release (const std::string &key)
 Destroy the pipeline, shader, descriptor sets, and buffers for a single key, without affecting any other key.
 
Portal::Graphics::GpuBufferHandle shared_buffer_handle (uint32_t set, size_t binding_index) const
 Non-owning view of the shared buffer at (set, binding_index).
 
void transition_image (const std::shared_ptr< Core::VKImage > &image, vk::ImageLayout old_layout, vk::ImageLayout new_layout)
 Transition a VKImage layout via an immediate command submission.
 
void upload (const std::string &key, size_t index, const float *data, size_t byte_size)
 
void upload_raw (const std::string &key, size_t index, const uint8_t *data, size_t byte_size)
 
void upload_shared_raw (uint32_t set, size_t binding_index, const uint8_t *data, size_t byte_size)
 
 ~GpuResourceManager ()
 

Private Member Functions

const PipelineUnit * find_unit (const std::string &key) const
 
Portal::Graphics::CommandBufferID record_sequence_commands (const std::vector< std::string > &keys, const std::vector< std::array< uint32_t, 3 > > &groups_per_key, const std::vector< std::vector< uint8_t > > &push_constants_per_key, const std::vector< std::vector< Portal::Graphics::HazardResource > > &hazards_per_key, const std::vector< Portal::Graphics::IndirectDispatch > &indirect_per_key)
 Record one command buffer holding a dispatch per key, with the barriers each stage's hazards owe the next.
 
PipelineUnit & unit_for (const std::string &key)
 

Private Attributes

std::unique_ptr< SharedBuffers > m_shared
 
std::unordered_map< std::string, std::unique_ptr< PipelineUnit > > m_units
 

Detailed Description

Encapsulates all Vulkan resource lifecycle behind Portal facades.

Manages a keyed set of pipelines, each with its own storage buffers, pipeline, shader, and descriptor sets. There is no distinct single- pipeline mode: a caller using exactly one shader simply uses one key throughout. PIMPL hides vk:: types from the header entirely.

Definition at line 22 of file GpuResourceManager.hpp.


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