344{
347 "Cannot allocate descriptor sets without pipeline");
348 return;
349 }
350
352
355
356 auto vt_layout = flow.get_view_transform_layout(
m_pipeline_id);
357 if (vt_layout) {
359
361 sizeof(Kinesis::ViewTransform),
365
366 foundry.update_descriptor_buffer(
368 0,
369 vk::DescriptorType::eUniformBuffer,
371 0,
372 sizeof(Kinesis::ViewTransform));
373
376 }
377
379
381 if (!tex_binding.texture
382 || !tex_binding.texture->is_initialized()
383 || !tex_binding.texture->get_image_view()) {
384 continue;
385 }
386
388 [binding](const auto& pair) {
389 return binding >= pair.second.binding
390 && binding < pair.second.binding + pair.second.count;
391 });
392
395 "No config for binding {}", binding);
396 continue;
397 }
398
399 const uint32_t set_index = config_it->second.set;
400
401 if (set_index == 0) {
404 "Engine descriptor set not allocated for set=0 texture binding {}", binding);
405 continue;
406 }
407 foundry.update_descriptor_image(
409 config_it->second.binding,
410 tex_binding.texture->get_image_view(),
411 tex_binding.sampler,
412 vk::ImageLayout::eShaderReadOnlyOptimal,
413 binding - config_it->second.binding);
414 continue;
415 }
416
418 if (!ds_index) {
420 "Descriptor set index {} out of range", binding);
421 continue;
422 }
423
424 foundry.update_descriptor_image(
426 config_it->second.binding,
427 tex_binding.texture->get_image_view(),
428 tex_binding.sampler,
429 vk::ImageLayout::eShaderReadOnlyOptimal,
430 binding - config_it->second.binding);
431 }
432
434 "Allocated {} descriptor sets and updated {} texture bindings",
436
439}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
Portal::Graphics::DescriptorSetID m_view_transform_descriptor_set_id
Portal::Graphics::RenderPipelineID m_pipeline_id
std::unordered_map< uint32_t, TextureBinding > m_texture_bindings
std::shared_ptr< VKBuffer > m_view_transform_ubo
std::optional< uint32_t > resolve_ds_index(uint32_t set) const
Resolve logical descriptor set index to actual index.
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
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
@ UNIFORM
Uniform buffer (host-visible)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
@ UNKNOWN
Unknown or undefined modality.
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.
constexpr DescriptorSetID INVALID_DESCRIPTOR_SET
std::unordered_map< std::string, ShaderBinding > bindings