Top Description Fields Constructors Methods
org.lwjgl.vulkan

public Class KHRPushDescriptor

extends Object
Class Inheritance
Imports
org.lwjgl.system.*

This extension allows descriptors to be written into the command buffer, while the implementation is responsible for managing their memory. Push descriptors may enable easier porting from older APIs and in some cases can be more efficient than writing descriptors into descriptor sets.
VK_KHR_push_descriptor
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_properties2
Contact
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

Modifier and TypeField and Description
public static final int
VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR

Extends VkDescriptorSetLayoutCreateFlagBits.

public static final int
VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR

Extends VkDescriptorUpdateTemplateType.

public static final String
public static final int
VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION

The extension specification version.

public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
nvkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, int
the number of elements in the pDescriptorWrites array.
descriptorWriteCount
,
long pDescriptorWrites)

Unsafe version of: CmdPushDescriptorSetKHR

public static void
vkCmdPushDescriptorSetKHR(VkCommandBuffer
the command buffer that the descriptors will be recorded in.
commandBuffer
,
int
a VkPipelineBindPoint indicating 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.
pipelineBindPoint
,
long
a VkPipelineLayout object used to program the bindings.
layout
,
int
the set number of the descriptor set in the pipeline layout that will be updated.
set
,
VkWriteDescriptorSet.Buffer
a pointer to an array of VkWriteDescriptorSet structures describing the descriptors to be updated.
pDescriptorWrites
)

Pushes descriptor updates into a command buffer.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHRback to summary
public static final int VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR

Extends VkDescriptorSetLayoutCreateFlagBits.

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_PUSH_DESCRIPTOR_EXTENSION_NAMEback to summary
public static final String VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME

The extension name.

VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSIONback to summary
public static final int VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION

The extension specification version.

VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHRback to summary
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR

Extends VkStructureType.

Constructor Detail

KHRPushDescriptorback to summary
protected KHRPushDescriptor()

Method Detail

nvkCmdPushDescriptorSetKHRback to summary
public static void nvkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, int pipelineBindPoint, long layout, int set, int descriptorWriteCount, long pDescriptorWrites)

Unsafe version of: CmdPushDescriptorSetKHR

Parameters
descriptorWriteCount:int

the number of elements in the pDescriptorWrites array.

vkCmdPushDescriptorSetKHRback to summary
public static void vkCmdPushDescriptorSetKHR(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 pipelineBindPoint until 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 offset member of VkDescriptorBufferInfo can be changed each time the descriptor is written.

Each element of pDescriptorWrites is interpreted as in VkWriteDescriptorSet, except the dstSet member is ignored.

To push an immutable sampler, use a VkWriteDescriptorSet with dstBinding and dstArrayElement selecting the immutable sampler’s binding. If the descriptor type is DESCRIPTOR_TYPE_SAMPLER, the pImageInfo parameter is ignored and the immutable sampler is taken from the push descriptor set layout in the pipeline layout. If the descriptor type is DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, the sampler member of the pImageInfo parameter is ignored and the immutable sampler is taken from the push descriptor set layout in the pipeline layout.

Valid Usage
Valid Usage (Implicit)
  • commandBuffer must be a valid VkCommandBuffer handle
  • pipelineBindPoint must be a valid VkPipelineBindPoint value
  • layout must be a valid VkPipelineLayout handle
  • pDescriptorWrites must be a valid pointer to an array of descriptorWriteCount valid VkWriteDescriptorSet structures
  • 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
  • descriptorWriteCount must be greater than 0
  • Both of commandBuffer, 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
See Also

VkWriteDescriptorSet

Parameters
commandBuffer:VkCommandBuffer

the command buffer that the descriptors will be recorded in.

pipelineBindPoint:int

a VkPipelineBindPoint indicating 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:long

a VkPipelineLayout object used to program the bindings.

set:int

the set number of the descriptor set in the pipeline layout that will be updated.

pDescriptorWrites:VkWriteDescriptorSet.Buffer

a pointer to an array of VkWriteDescriptorSet structures describing the descriptors to be updated.

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.