339{
342 "Cannot allocate descriptor sets without pipeline");
343 return;
344 }
345
347
350
351 auto vt_layout = flow.get_view_transform_layout(
m_pipeline_id);
352 if (vt_layout) {
354
356 sizeof(Kinesis::ViewTransform),
357 VKBuffer::Usage::UNIFORM,
360
361 foundry.update_descriptor_buffer(
363 0,
364 vk::DescriptorType::eUniformBuffer,
366 0,
367 sizeof(Kinesis::ViewTransform));
368
371 }
372
374
376 if (!tex_binding.texture
377 || !tex_binding.texture->is_initialized()
378 || !tex_binding.texture->get_image_view()) {
379 continue;
380 }
381
383 [binding](const auto& pair) {
384 return binding >= pair.second.binding
385 && binding < pair.second.binding + pair.second.count;
386 });
387
390 "No config for binding {}", binding);
391 continue;
392 }
393
394 const uint32_t set_index = config_it->second.set;
395
396 if (set_index == 0) {
399 "Engine descriptor set not allocated for set=0 texture binding {}", binding);
400 continue;
401 }
402 foundry.update_descriptor_image(
404 config_it->second.binding,
405 tex_binding.texture->get_image_view(),
406 tex_binding.sampler,
407 vk::ImageLayout::eShaderReadOnlyOptimal,
408 binding - config_it->second.binding);
409 continue;
410 }
411
413 if (!ds_index) {
415 "Descriptor set index {} out of range", binding);
416 continue;
417 }
418
419 foundry.update_descriptor_image(
421 config_it->second.binding,
422 tex_binding.texture->get_image_view(),
423 tex_binding.sampler,
424 vk::ImageLayout::eShaderReadOnlyOptimal,
425 binding - config_it->second.binding);
426 }
427
429 "Allocated {} descriptor sets and updated {} texture bindings",
431
434}
#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)
@ 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