0
\$\begingroup\$

I'm exploring the VkDescriptorUpdateTemplate usage and really like the efficiency in coding this versus individual DescriptorSets, except I have one concern. When making an UpdateTemplate for each shader "program" with multiple UBOs, SSBOs, combined image samplers, etc. and attempting to update a single buffer/sampler, I have to update them all based on the template. In reading the specification and googling (not much information on descriptor templates), it isn't clear if there is a way to update only part of the DescriptorTemplate and allow the remainder of the bindings to remain.

Quick Code Example (Updating all three buffer/sampler bindings). This works but in changing the sampler, I have to rebind the other buffers as well.

FDescriptorInfo Sampler(LinearSampler, Tex->ImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
FDescriptorInfo Desc[] = {VertexBuffer, CameraBuffer, Sampler};
vkCmdPushDescriptorSetWithTemplateKHR(Vulkan->CommandBuffer, Vulkan->MeshProgram.UpdateTemplate, Vulkan->MeshProgram.Layout, 0, Desc);

If I just want to update the combined image sampler; is there a way to only update the 3rd binding? The example below gives validation errors along with attempting to just pass a single DescriptorInfo as there is no way to tell PushDesctiptor which binding I want to update versus all of them in the template.

FDescriptorInfo Sampler(LinearSampler, Tex->ImageView, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
FDescriptorInfo Desc[] = {0, 0, Sampler};
// FDescriptorInfo Desc[] = {Sampler}; // Also tried this but there is no way to tell vkCmdPushDescriptorSetWithTemplate I'm only updating the 3rd binding.
vkCmdPushDescriptorSetWithTemplateKHR(Vulkan->CommandBuffer, Vulkan->MeshProgram.UpdateTemplate, Vulkan->MeshProgram.Layout, 0, Desc);

Is it possible to reduce re-binding/re-pushing other buffers when utilizing the DescriptorSetTemplates?

Thanks in advance for any advice.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.