C Specification

Once a VkDescriptorUpdateTemplate has been created, descriptor sets can be updated by calling:

void vkUpdateDescriptorSetWithTemplate(
    VkDevice                                    device,
    VkDescriptorSet                             descriptorSet,
    VkDescriptorUpdateTemplate                  descriptorUpdateTemplate,
    const void*                                 pData);

or the equivalent command

void vkUpdateDescriptorSetWithTemplateKHR(
    VkDevice                                    device,
    VkDescriptorSet                             descriptorSet,
    VkDescriptorUpdateTemplate                  descriptorUpdateTemplate,
    const void*                                 pData);


  • device is the logical device that updates the descriptor sets.

  • descriptorSet is the descriptor set to update

  • descriptorUpdateTemplate is a VkDescriptorUpdateTemplate object specifying the update mapping between pData and the descriptor set to update.

  • pData is a pointer to memory containing one or more VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView structures used to write the descriptors.


Valid Usage
Valid Usage (Implicit)
  • device must be a valid VkDevice handle

  • descriptorSet must be a valid VkDescriptorSet handle

  • descriptorUpdateTemplate must be a valid VkDescriptorUpdateTemplate handle

  • descriptorUpdateTemplate must have been created, allocated, or retrieved from device

Host Synchronization
  • Host access to descriptorSet must be externally synchronized

API example
struct AppBufferView {
    VkBufferView bufferView;
    uint32_t     applicationRelatedInformation;

struct AppDataStructure
    VkDescriptorImageInfo  imageInfo;          // a single image info
    VkDescriptorBufferInfo bufferInfoArray[3]; // 3 buffer infos in an array
    AppBufferView          bufferView[2];      // An application defined structure containing a bufferView
    // ... some more application related data

const VkDescriptorUpdateTemplateEntry descriptorUpdateTemplateEntries[] =
    // binding to a single image descriptor
        0,                                           // binding
        0,                                           // dstArrayElement
        1,                                           // descriptorCount
        offsetof(AppDataStructure, imageInfo),       // offset
        0                                            // stride is not required if descriptorCount is 1

    // binding to an array of buffer descriptors
        1,                                           // binding
        0,                                           // dstArrayElement
        3,                                           // descriptorCount
        VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,           // descriptorType
        offsetof(AppDataStructure, bufferInfoArray), // offset
        sizeof(VkDescriptorBufferInfo)               // stride, descriptor buffer infos are compact

    // binding to an array of buffer views
        2,                                           // binding
        0,                                           // dstArrayElement
        2,                                           // descriptorCount
        VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,     // descriptorType
        offsetof(AppDataStructure, bufferView) +
          offsetof(AppBufferView, bufferView),       // offset
        sizeof(AppBufferView)                        // stride, bufferViews do not have to be compact

// create a descriptor update template for descriptor set updates
const VkDescriptorUpdateTemplateCreateInfo createInfo =
    NULL,                                                      // pNext
    0,                                                         // flags
    3,                                                         // descriptorUpdateEntryCount
    descriptorUpdateTemplateEntries,                           // pDescriptorUpdateEntries
    myLayout,                                                  // descriptorSetLayout
    0,                                                         // pipelineBindPoint, ignored by given templateType
    0,                                                         // pipelineLayout, ignored by given templateType
    0,                                                         // set, ignored by given templateType

VkDescriptorUpdateTemplate myDescriptorUpdateTemplate;
myResult = vkCreateDescriptorUpdateTemplate(

AppDataStructure appData;

// fill appData here or cache it in your engine
vkUpdateDescriptorSetWithTemplate(myDevice, myDescriptorSet, myDescriptorUpdateTemplate, &appData);

See Also

Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.