Class KHRPushDescriptor
- Name String
VK_KHR_push_descriptor- Extension Type
- Device extension
- Registered Extension Number
- 81
- Revision
- 2
- Extension and Version Dependencies
VK_KHR_get_physical_device_properties2or Version 1.1- API Interactions
- Interacts with VK_VERSION_1_1
- Interacts with VK_KHR_descriptor_update_template
- Contact
- Jeff Bolz jeffbolznv
Other Extension Metadata
- Last Modified Date
- 2017-09-12
- IP Status
- No known IP claims.
- Contributors
- Jeff Bolz, NVIDIA
- Michael Worcester, Imagination Technologies
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExtendsVkDescriptorSetLayoutCreateFlagBits.static final intExtendsVkDescriptorUpdateTemplateType.static final StringThe extension name.static final intThe extension specification version.static final intExtendsVkStructureType. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidnvkCmdPushDescriptorSetKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, int descriptorWriteCount, long pDescriptorWrites) Unsafe version of:CmdPushDescriptorSetKHRstatic voidvkCmdPushDescriptorSetKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, VkWriteDescriptorSet.Buffer pDescriptorWrites) Pushes descriptor updates into a command buffer.static voidvkCmdPushDescriptorSetWithTemplateKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, long descriptorUpdateTemplate, long layout, int set, long pData) Pushes descriptor updates into a command buffer using a descriptor update template.
-
Field Details
-
VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION
public static final int VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSIONThe extension specification version.- See Also:
-
VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME
The extension name.- See Also:
-
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHRExtendsVkStructureType.- See Also:
-
VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
public static final int VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHRExtendsVkDescriptorSetLayoutCreateFlagBits.- See Also:
-
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR
public static final int VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHRExtendsVkDescriptorUpdateTemplateType.- See Also:
-
-
Method Details
-
nvkCmdPushDescriptorSetKHR
public static void nvkCmdPushDescriptorSetKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, int descriptorWriteCount, long pDescriptorWrites) Unsafe version of:CmdPushDescriptorSetKHR- Parameters:
descriptorWriteCount- the number of elements in thepDescriptorWritesarray.
-
vkCmdPushDescriptorSetKHR
public static void vkCmdPushDescriptorSetKHR(org.lwjgl.vulkan.VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, VkWriteDescriptorSet.Buffer pDescriptorWrites) Pushes descriptor updates into a command buffer.C Specification
In addition to allocating descriptor sets and binding them to a command buffer, an application can record descriptor updates into the command buffer.
To push descriptor updates into a command buffer, call:
void vkCmdPushDescriptorSetKHR( VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites);Description
Push descriptors are a small bank of descriptors whose storage is internally managed by the command buffer rather than being written into a descriptor set and later bound to a command buffer. Push descriptors allow for incremental updates of descriptors without managing the lifetime of descriptor sets.
When a command buffer begins recording, all push descriptors are undefined. Push descriptors can be updated incrementally and cause shaders to use the updated descriptors for subsequent bound pipeline commands with the pipeline type set by
pipelineBindPointuntil the descriptor is overwritten, or else until the set is disturbed as described in Pipeline Layout Compatibility. When the set is disturbed or push descriptors with a different descriptor set layout are set, all push descriptors are undefined.Push descriptors that are statically used by a pipeline must not be undefined at the time that a drawing or dispatching command is recorded to execute using that pipeline. This includes immutable sampler descriptors, which must be pushed before they are accessed by a pipeline (the immutable samplers are pushed, rather than the samplers in
pDescriptorWrites). Push descriptors that are not statically used can remain undefined.Push descriptors do not use dynamic offsets. Instead, the corresponding non-dynamic descriptor types can be used and the
offsetmember ofVkDescriptorBufferInfocan be changed each time the descriptor is written.Each element of
pDescriptorWritesis interpreted as inVkWriteDescriptorSet, except thedstSetmember is ignored.To push an immutable sampler, use a
VkWriteDescriptorSetwithdstBindinganddstArrayElementselecting the immutable sampler’s binding. If the descriptor type isDESCRIPTOR_TYPE_SAMPLER, thepImageInfoparameter is ignored and the immutable sampler is taken from the push descriptor set layout in the pipeline layout. If the descriptor type isDESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, thesamplermember of thepImageInfoparameter is ignored and the immutable sampler is taken from the push descriptor set layout in the pipeline layout.Valid Usage
setmust be less thanVkPipelineLayoutCreateInfo::setLayoutCountprovided whenlayoutwas createdsetmust be the unique set number in the pipeline layout that uses a descriptor set layout that was created withDESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR- For each element
iwherepDescriptorWrites[i].descriptorTypeisDESCRIPTOR_TYPE_SAMPLER,DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,DESCRIPTOR_TYPE_SAMPLED_IMAGE,DESCRIPTOR_TYPE_STORAGE_IMAGE, orDESCRIPTOR_TYPE_INPUT_ATTACHMENT,pDescriptorWrites[i].pImageInfomust be a valid pointer to an array ofpDescriptorWrites[i].descriptorCountvalidVkDescriptorImageInfostructures pipelineBindPointmust be supported by thecommandBuffer’s parentVkCommandPool’s queue family
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlepipelineBindPointmust be a validVkPipelineBindPointvaluelayoutmust be a validVkPipelineLayouthandlepDescriptorWritesmust be a valid pointer to an array ofdescriptorWriteCountvalidVkWriteDescriptorSetstructurescommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support graphics, or compute operations - This command must only be called outside of a video coding scope
descriptorWriteCountmust be greater than 0- Both of
commandBuffer, andlayoutmust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type Primary Secondary Both Outside Graphics Compute State See Also
- Parameters:
commandBuffer- the command buffer that the descriptors will be recorded in.pipelineBindPoint- aVkPipelineBindPointindicating the type of the pipeline that will use the descriptors. There is a separate set of push descriptor bindings for each pipeline type, so binding one does not disturb the others.layout- aVkPipelineLayoutobject used to program the bindings.set- the set number of the descriptor set in the pipeline layout that will be updated.pDescriptorWrites- a pointer to an array ofVkWriteDescriptorSetstructures describing the descriptors to be updated.
-
vkCmdPushDescriptorSetWithTemplateKHR
public static void vkCmdPushDescriptorSetWithTemplateKHR(org.lwjgl.vulkan.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
- The
pipelineBindPointspecified during the creation of the descriptor update template must be supported by thecommandBuffer’s parentVkCommandPool’s queue family pDatamust be a valid pointer to a memory containing one or more valid instances ofVkDescriptorImageInfo,VkDescriptorBufferInfo, orVkBufferViewin a layout defined bydescriptorUpdateTemplatewhen it was created withCreateDescriptorUpdateTemplatelayoutmust be compatible with the layout used to createdescriptorUpdateTemplatedescriptorUpdateTemplatemust have been created with atemplateTypeofDESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHRsetmust be the same value used to createdescriptorUpdateTemplatesetmust be less thanVkPipelineLayoutCreateInfo::setLayoutCountprovided whenlayoutwas createdsetmust be the unique set number in the pipeline layout that uses a descriptor set layout that was created withDESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandledescriptorUpdateTemplatemust be a validVkDescriptorUpdateTemplatehandlelayoutmust be a validVkPipelineLayouthandlecommandBuffermust be in the recording state- The
VkCommandPoolthatcommandBufferwas allocated from must support graphics, or compute operations - This command must only be called outside of a video coding scope
- Each of
commandBuffer,descriptorUpdateTemplate, andlayoutmust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type Primary Secondary Both Outside Graphics Compute State 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- the command buffer that the descriptors will be recorded in.descriptorUpdateTemplate- a descriptor update template defining how to interpret the descriptor information inpData.layout- aVkPipelineLayoutobject used to program the bindings. It must be compatible with the layout used to create thedescriptorUpdateTemplatehandle.set- the set number of the descriptor set in the pipeline layout that will be updated. This must be the same number used to create thedescriptorUpdateTemplatehandle.pData- a pointer to memory containing descriptors for the templated update.
- The
-