444{
448 "Cannot allocate descriptor sets without pipeline");
449 }
450 return;
451 }
452
454
457
458 auto transform_layout = flow.get_view_transform_layout(
m_pipeline_id);
459 if (transform_layout) {
461
463 sizeof(Kinesis::RenderTransform),
464 VKBuffer::Usage::UNIFORM,
467
468 foundry.update_descriptor_buffer(
470 0,
471 vk::DescriptorType::eUniformBuffer,
473 0,
474 sizeof(Kinesis::RenderTransform));
475
477 "RenderTransform UBO allocated (pipeline {})",
m_pipeline_id);
478 }
479
481
483 if (!tex_binding.texture
484 || !tex_binding.texture->is_initialized()
485 || !tex_binding.texture->get_image_view()) {
486 continue;
487 }
488
490 [binding](const auto& pair) {
491 return binding >= pair.second.binding
492 && binding < pair.second.binding + pair.second.count;
493 });
494
497 "No config for binding {}", binding);
498 continue;
499 }
500
501 const uint32_t set_index = config_it->second.set;
502
503 if (set_index == 0) {
506 "Engine descriptor set not allocated for set=0 texture binding {}", binding);
507 continue;
508 }
509 foundry.update_descriptor_image(
511 config_it->second.binding,
512 tex_binding.texture->get_image_view(),
513 tex_binding.sampler,
514 vk::ImageLayout::eShaderReadOnlyOptimal,
515 binding - config_it->second.binding);
516 continue;
517 }
518
520 if (!ds_index) {
522 "Descriptor set index {} out of range", binding);
523 continue;
524 }
525
526 foundry.update_descriptor_image(
528 config_it->second.binding,
529 tex_binding.texture->get_image_view(),
530 tex_binding.sampler,
531 vk::ImageLayout::eShaderReadOnlyOptimal,
532 binding - config_it->second.binding);
533 }
534
536 "Allocated {} descriptor sets and updated {} texture bindings",
538
541}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
Portal::Graphics::RenderPipelineID m_pipeline_id
std::unordered_map< uint32_t, TextureBinding > m_texture_bindings
Portal::Graphics::DescriptorSetID m_render_transform_descriptor_set_id
std::shared_ptr< VKBuffer > m_render_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.
bool m_needs_pipeline_rebuild
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
@ 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