Top Description Fields Constructors Methods
org.lwjgl.vulkan

public Class KHRDescriptorUpdateTemplate

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

Applications may wish to update a fixed set of descriptors in a large number of descriptor sets very frequently, i.e. during initialization phase or if it is required to rebuild descriptor sets for each frame. For those cases it is also not unlikely that all information required to update a single descriptor set is stored in a single struct. This extension provides a way to update a fixed set of descriptors in a single VkDescriptorSet with a pointer to a user defined data structure describing the new descriptors.
Promotion to Vulkan 1.1

CmdPushDescriptorSetWithTemplateKHR is included as an interaction with VK_KHR_push_descriptor. If Vulkan 1.1 and VK_KHR_push_descriptor are supported, this is included by VK_KHR_push_descriptor.

The base functionality in this extension is included in core Vulkan 1.1, with the KHR suffix omitted. The original type, enum and command names are still available as aliases of the core functionality.

VK_KHR_descriptor_update_template
Name String
VK_KHR_descriptor_update_template
Extension Type
Device extension
Registered Extension Number
86
Revision
1
Deprecation state
Contact
Other Extension Metadata
Last Modified Date
2017-09-05
IP Status
No known IP claims.
Interactions and External Dependencies
Contributors
  • Jeff Bolz, NVIDIA
  • Michael Worcester, Imagination Technologies

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR

Extends VkDescriptorUpdateTemplateType.

public static final int
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR

Extends VkDescriptorUpdateTemplateType.

public static final String
public static final int
VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION

The extension specification version.

public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static int
nvkCreateDescriptorUpdateTemplateKHR(VkDevice device, long pCreateInfo, long pAllocator, long pDescriptorUpdateTemplate)

Unsafe version of: CreateDescriptorUpdateTemplateKHR

public static void
nvkDestroyDescriptorUpdateTemplateKHR(VkDevice device, long descriptorUpdateTemplate, long pAllocator)

Unsafe version of: DestroyDescriptorUpdateTemplateKHR

public static void
vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer
the command buffer that the descriptors will be recorded in.
commandBuffer
,
long
a descriptor update template defining how to interpret the descriptor information in pData.
descriptorUpdateTemplate
,
long
a VkPipelineLayout object used to program the bindings. It must be compatible with the layout used to create the descriptorUpdateTemplate handle.
layout
,
int
the set number of the descriptor set in the pipeline layout that will be updated. This must be the same number used to create the descriptorUpdateTemplate handle.
set
,
long
a pointer to memory containing descriptors for the templated update.
pData
)

Pushes descriptor updates into a command buffer using a descriptor update template.

public static int
vkCreateDescriptorUpdateTemplateKHR(VkDevice
the logical device that creates the descriptor update template.
device
,
VkDescriptorUpdateTemplateCreateInfo
a pointer to a VkDescriptorUpdateTemplateCreateInfo structure specifying the set of descriptors to update with a single call to CmdPushDescriptorSetWithTemplateKHR or UpdateDescriptorSetWithTemplate.
pCreateInfo
,
VkAllocationCallbacks
controls host memory allocation as described in the Memory Allocation chapter.
pAllocator
,
LongBuffer
a pointer to a VkDescriptorUpdateTemplate handle in which the resulting descriptor update template object is returned.
pDescriptorUpdateTemplate
)

See CreateDescriptorUpdateTemplate.

public static int
vkCreateDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplateCreateInfo pCreateInfo, VkAllocationCallbacks pAllocator, long[] pDescriptorUpdateTemplate)

Array version of: CreateDescriptorUpdateTemplateKHR

public static void
vkDestroyDescriptorUpdateTemplateKHR(VkDevice
the logical device that has been used to create the descriptor update template
device
,
long
the descriptor update template to destroy.
descriptorUpdateTemplate
,
VkAllocationCallbacks
controls host memory allocation as described in the Memory Allocation chapter.
pAllocator
)

See DestroyDescriptorUpdateTemplate.

public static void
vkUpdateDescriptorSetWithTemplateKHR(VkDevice
the logical device that updates the descriptor set.
device
,
long
the descriptor set to update
descriptorSet
,
long
a VkDescriptorUpdateTemplate object specifying the update mapping between pData and the descriptor set to update.
descriptorUpdateTemplate
,
long
a pointer to memory containing one or more VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView structures or VkAccelerationStructureKHR or VkAccelerationStructureNV handles used to write the descriptors.
pData
)

See UpdateDescriptorSetWithTemplate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXTback to summary
public static final int VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT

Extends VkDebugReportObjectTypeEXT.

VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHRback to summary
public static final int VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR

Extends VkDescriptorUpdateTemplateType.

VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHRback to summary
public static final int VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR

Extends VkDescriptorUpdateTemplateType.

VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAMEback to summary
public static final String VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME

The extension name.

VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSIONback to summary
public static final int VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION

The extension specification version.

VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHRback to summary
public static final int VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR

Extends VkObjectType.

VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHRback to summary
public static final int VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR

Extends VkStructureType.

Constructor Detail

KHRDescriptorUpdateTemplateback to summary
protected KHRDescriptorUpdateTemplate()

Method Detail

nvkCreateDescriptorUpdateTemplateKHRback to summary
public static int nvkCreateDescriptorUpdateTemplateKHR(VkDevice device, long pCreateInfo, long pAllocator, long pDescriptorUpdateTemplate)

Unsafe version of: CreateDescriptorUpdateTemplateKHR

nvkDestroyDescriptorUpdateTemplateKHRback to summary
public static void nvkDestroyDescriptorUpdateTemplateKHR(VkDevice device, long descriptorUpdateTemplate, long pAllocator)

Unsafe version of: DestroyDescriptorUpdateTemplateKHR

vkCmdPushDescriptorSetWithTemplateKHRback to summary
public static void vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, long descriptorUpdateTemplate, long layout, int set, long pData)

Pushes descriptor updates into a command buffer using a descriptor update template.

C Specification

It is also possible to use a descriptor update template to specify the push descriptors to update. To do so, call:


void vkCmdPushDescriptorSetWithTemplateKHR(
    VkCommandBuffer                             commandBuffer,
    VkDescriptorUpdateTemplate                  descriptorUpdateTemplate,
    VkPipelineLayout                            layout,
    uint32_t                                    set,
    const void*                                 pData);
Valid Usage
Valid Usage (Implicit)
  • commandBuffer must be a valid VkCommandBuffer handle
  • descriptorUpdateTemplate must be a valid VkDescriptorUpdateTemplate handle
  • layout must be a valid VkPipelineLayout handle
  • commandBuffer must be in the recording state
  • The VkCommandPool that commandBuffer was allocated from must support graphics, or compute operations
  • This command must only be called outside of a video coding scope
  • Each of commandBuffer, descriptorUpdateTemplate, and layout must have been created, allocated, or retrieved from the same VkDevice
Host Synchronization
  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized
Command Properties
Command Buffer LevelsRender Pass ScopeVideo Coding ScopeSupported Queue TypesCommand Type
Primary SecondaryBothOutsideGraphics ComputeState

struct AppDataStructure
{
    VkDescriptorImageInfo  imageInfo;          // a single image info
    // ... some more application related data
};

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

// create a descriptor update template for push descriptor set updates
const VkDescriptorUpdateTemplateCreateInfo createInfo =
{
    .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO,
    .pNext = NULL,
    .flags = 0,
    .descriptorUpdateEntryCount = 1,
    .pDescriptorUpdateEntries = descriptorUpdateTemplateEntries,
    .templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR,
    .descriptorSetLayout = 0,   // ignored by given templateType
    .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
    .pipelineLayout = myPipelineLayout,
    .set = 0,
};

VkDescriptorUpdateTemplate myDescriptorUpdateTemplate;
myResult = vkCreateDescriptorUpdateTemplate(
    myDevice,
    &createInfo,
    NULL,
    &myDescriptorUpdateTemplate);

AppDataStructure appData;
// fill appData here or cache it in your engine
vkCmdPushDescriptorSetWithTemplateKHR(myCmdBuffer, myDescriptorUpdateTemplate, myPipelineLayout, 0,&appData);
Parameters
commandBuffer:VkCommandBuffer

the command buffer that the descriptors will be recorded in.

descriptorUpdateTemplate:long

a descriptor update template defining how to interpret the descriptor information in pData.

layout:long

a VkPipelineLayout object used to program the bindings. It must be compatible with the layout used to create the descriptorUpdateTemplate handle.

set:int

the set number of the descriptor set in the pipeline layout that will be updated. This must be the same number used to create the descriptorUpdateTemplate handle.

pData:long

a pointer to memory containing descriptors for the templated update.

vkCreateDescriptorUpdateTemplateKHRback to summary
public static int vkCreateDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplateCreateInfo pCreateInfo, VkAllocationCallbacks pAllocator, LongBuffer pDescriptorUpdateTemplate)

See CreateDescriptorUpdateTemplate.

Parameters
device:VkDevice

the logical device that creates the descriptor update template.

pCreateInfo:VkDescriptorUpdateTemplateCreateInfo

a pointer to a VkDescriptorUpdateTemplateCreateInfo structure specifying the set of descriptors to update with a single call to CmdPushDescriptorSetWithTemplateKHR or UpdateDescriptorSetWithTemplate.

pAllocator:VkAllocationCallbacks

controls host memory allocation as described in the Memory Allocation chapter.

pDescriptorUpdateTemplate:LongBuffer

a pointer to a VkDescriptorUpdateTemplate handle in which the resulting descriptor update template object is returned.

Annotations
@NativeType:VkResult
vkCreateDescriptorUpdateTemplateKHRback to summary
public static int vkCreateDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplateCreateInfo pCreateInfo, VkAllocationCallbacks pAllocator, long[] pDescriptorUpdateTemplate)

Array version of: CreateDescriptorUpdateTemplateKHR

Annotations
@NativeType:VkResult
vkDestroyDescriptorUpdateTemplateKHRback to summary
public static void vkDestroyDescriptorUpdateTemplateKHR(VkDevice device, long descriptorUpdateTemplate, VkAllocationCallbacks pAllocator)

See DestroyDescriptorUpdateTemplate.

Parameters
device:VkDevice

the logical device that has been used to create the descriptor update template

descriptorUpdateTemplate:long

the descriptor update template to destroy.

pAllocator:VkAllocationCallbacks

controls host memory allocation as described in the Memory Allocation chapter.

vkUpdateDescriptorSetWithTemplateKHRback to summary
public static void vkUpdateDescriptorSetWithTemplateKHR(VkDevice device, long descriptorSet, long descriptorUpdateTemplate, long pData)

See UpdateDescriptorSetWithTemplate.

Parameters
device:VkDevice

the logical device that updates the descriptor set.

descriptorSet:long

the descriptor set to update

descriptorUpdateTemplate:long

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

pData:long

a pointer to memory containing one or more VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView structures or VkAccelerationStructureKHR or VkAccelerationStructureNV handles used to write the descriptors.