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

◆ initialize_descriptors()

void MayaFlux::Buffers::RenderProcessor::initialize_descriptors ( const std::shared_ptr< VKBuffer > &  buffer)
overrideprotectedvirtual

Implements MayaFlux::Buffers::ShaderProcessor.

Definition at line 211 of file RenderProcessor.cpp.

212{
215 "Cannot allocate descriptor sets without pipeline");
216 return;
217 }
218
220
222
223 m_descriptor_set_ids = flow.allocate_pipeline_descriptors(m_pipeline_id);
224
225 if (m_descriptor_set_ids.empty()) {
227 "Failed to allocate descriptor sets for pipeline");
228 return;
229 }
230
231 for (const auto& [binding, tex_binding] : m_texture_bindings) {
232 auto config_it = std::ranges::find_if(m_config.bindings,
233 [binding](const auto& pair) {
234 return pair.second.binding == binding;
235 });
236
237 if (config_it == m_config.bindings.end()) {
239 "No config for binding {}", binding);
240 continue;
241 }
242 uint32_t set_index = config_it->second.set;
243
244 if (set_index >= m_descriptor_set_ids.size()) {
246 "Descriptor set index {} out of range", binding);
247 continue;
248 }
249
250 auto& foundry = Portal::Graphics::get_shader_foundry();
251 foundry.update_descriptor_image(
252 m_descriptor_set_ids[set_index],
253 config_it->second.binding,
254 tex_binding.texture->get_image_view(),
255 tex_binding.sampler,
256 vk::ImageLayout::eShaderReadOnlyOptimal);
257 }
258
260 "Allocated {} descriptor sets and updated {} texture bindings",
262
263 update_descriptors(buffer);
265}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
Portal::Graphics::RenderPipelineID m_pipeline_id
std::unordered_map< uint32_t, TextureBinding > m_texture_bindings
virtual void on_descriptors_created()
Called after descriptor sets are created.
virtual void update_descriptors(const std::shared_ptr< VKBuffer > &buffer)
virtual void on_before_descriptors_create()
Called before descriptor sets are created.
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
constexpr RenderPipelineID INVALID_RENDER_PIPELINE
MAYAFLUX_API RenderFlow & get_render_flow()
Get the global render flow instance.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::get_render_flow(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::INVALID_RENDER_PIPELINE, MayaFlux::Buffers::ShaderProcessor::m_config, MayaFlux::Buffers::ShaderProcessor::m_descriptor_set_ids, m_pipeline_id, m_texture_bindings, MF_DEBUG, MF_ERROR, MF_RT_ERROR, MayaFlux::Buffers::ShaderProcessor::on_before_descriptors_create(), MayaFlux::Buffers::ShaderProcessor::on_descriptors_created(), and MayaFlux::Buffers::ShaderProcessor::update_descriptors().

+ Here is the call graph for this function: