MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ initialise()

bool MayaFlux::Yantra::GpuResourceManager::initialise ( const GpuShaderConfig config,
const std::vector< GpuBufferBinding > &  bindings 
)

Definition at line 110 of file GpuResourceManager.cpp.

112{
113 if (m_ready) {
114 return true;
115 }
116
117 auto& foundry = Portal::Graphics::get_shader_foundry();
118 auto& compute_press = Portal::Graphics::get_compute_press();
119
120 m_shader_id = foundry.load_shader(config.shader_path);
123 "GpuResourceManager: failed to load shader '{}'", config.shader_path);
124 return false;
125 }
126
127 m_pipeline_id = compute_press.create_pipeline_auto(
128 m_shader_id, config.push_constant_size);
129
132 "GpuResourceManager: failed to create pipeline for '{}'",
133 config.shader_path);
134 foundry.destroy_shader(m_shader_id);
136 return false;
137 }
138
139 m_descriptor_set_ids = compute_press.allocate_pipeline_descriptors(m_pipeline_id);
140 if (m_descriptor_set_ids.empty()) {
142 "GpuResourceManager: failed to allocate descriptor sets");
143 compute_press.destroy_pipeline(m_pipeline_id);
145 foundry.destroy_shader(m_shader_id);
147 return false;
148 }
149
150 m_impl = std::make_unique<GpuResourceManagerImpl>();
151 m_impl->buffers.resize(bindings.size());
152 m_buffer_slots.resize(bindings.size());
153 m_image_slots.resize(bindings.size());
154
155 m_ready = true;
156 return true;
157}
#define MF_ERROR(comp, ctx,...)
Portal::Graphics::ComputePipelineID m_pipeline_id
std::vector< std::shared_ptr< Core::VKImage > > m_image_slots
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
std::unique_ptr< GpuResourceManagerImpl > m_impl
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
constexpr ShaderID INVALID_SHADER
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr ComputePipelineID INVALID_COMPUTE_PIPELINE
MAYAFLUX_API ComputePress & get_compute_press()

References MayaFlux::Journal::BufferProcessing, MayaFlux::Portal::Graphics::get_compute_press(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::INVALID_COMPUTE_PIPELINE, MayaFlux::Portal::Graphics::INVALID_SHADER, m_buffer_slots, m_descriptor_set_ids, m_image_slots, m_impl, m_pipeline_id, m_ready, m_shader_id, MF_ERROR, MayaFlux::Yantra::GpuShaderConfig::push_constant_size, MayaFlux::Yantra::GpuShaderConfig::shader_path, and MayaFlux::Journal::Yantra.

Referenced by MayaFlux::Yantra::GpuDispatchCore::ensure_gpu_ready().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: