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

◆ bind_images_batch()

void MayaFlux::Yantra::GpuResourceManager::bind_images_batch ( const std::string &  key,
const std::vector< ImageBind > &  images 
)

Bind every image in one Vulkan call.

Equivalent to calling bind_image_storage or bind_image_sampled once per entry (routed by spec.element_type), except every entry is submitted through a single vkUpdateDescriptorSets call. Also records each image in the pipeline unit's image_slots, same as the per-call methods.

Definition at line 547 of file GpuResourceManager.cpp.

548{
549 auto& unit = unit_for(key);
550 auto& foundry = Portal::Graphics::get_shader_foundry();
551
552 std::vector<Portal::Graphics::DescriptorImageWrite> writes;
553 writes.reserve(images.size());
554
555 for (const auto& entry : images) {
556 if (entry.index >= unit.image_slots.size())
557 unit.image_slots.resize(entry.index + 1);
558 unit.image_slots[entry.index] = entry.image;
559
560 const bool is_storage = entry.spec.element_type == GpuBufferBinding::ElementType::IMAGE_STORAGE;
561 writes.push_back({
562 .descriptor_set_id = unit.descriptor_set_ids[entry.spec.set],
563 .binding = entry.spec.binding,
564 .type = is_storage ? vk::DescriptorType::eStorageImage : vk::DescriptorType::eCombinedImageSampler,
565 .image_view = entry.image->get_image_view(),
566 .sampler = entry.sampler,
567 .layout = is_storage ? vk::ImageLayout::eGeneral : vk::ImageLayout::eShaderReadOnlyOptimal,
568 });
569 }
570
571 foundry.update_descriptor_images(writes);
572}
PipelineUnit & unit_for(const std::string &key)
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.

References MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_STORAGE, and unit_for().

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

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