Graphics‎ > ‎Graphic API‎ > ‎Vulkan‎ > ‎

Binding

Descriptor



Descriptor Set Layout
A descriptor set layout object describe the types and number of descriptors. To create it one use a descriptor binding for each descriptor. It describes it's type, the count (if its an array) and the shaders stages that can access the descriptor.

vkCreateDescriptorSetLayout
Creates a descriptor set layout by using an array of LayoutBinding structure. The structure contain the type of descriptor, a count so it can be an array of that type and flags that tell what shader stages the descriptor can be used from. It also contain a binding number and it is used in shaders to refer to the descriptor.

vkDestroyDescriptorSetLayout
Destroys a descriptor set layout.

Pipeline Layouts
A Pipeline Layout describe the set of resources that can be accessed by a pipeline. It contain zero or more descriptor set layouts and zero or more push constant ranges.

vkCreatePipelineLayout
To create a Pipeline Layout one send in a array of Descriptor Set Layouts and an array of push constant ranges. The index of each layout is it's set number.

From GLSL use the layout() with the 'set' to select set and binding point.

layout(set = 0, binding = 0) uniform sampler2D ts3;

vkDestroyPipelineLayout
Destroy a pipeline layout.

Descriptor pool
Descriptor pool objects are used to allocate descriptor sets and descriptors. When a pool is created one say the max number of descriptor sets it should be able to contain and also the max number of descriptor of each type. Descriptor pools are externally synchronized so the application must not allocate and/or free descriptor sets from the same pool in multiple threads simultaneously.

vkCreateDescriptorPool
Create a new descriptor pool. List the max number of sets and the poolsize for each descriptor type it will support. To be able to free individual descriptor (vkFreeDescriptorSets) set one need to use the flag VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT. If it is not set only vkResetDescriptorPool can be used to free all descriptors at once.

vkDestroyDescriptorPool
Used to destroy a descriptor pool. All Descriptor Set allocated from the pool will then also be freed. All commands that refer to the descriptor sets allocated from the pool must have completed execution.

vkResetDescriptorPool
Reset the descriptor pool. It will free all the descriptor sets allocated from the pool.


Descriptor Set
vkAllocateDescriptorSets
Create one or more descriptors sets from the selected pool. A set is created using a Descriptor Set Layout as a template. The set is uninitialized and all descriptors are undefined but it can be bound to a command buffer. Entries that will be used by the pipeline must be populated before they are accessed by a pipeline.

vkFreeDescriptorSets
Free an array of descriptor sets.

vkUpdateDescriptorSets
Used to write data to descriptors in sets and/or copy data from sets to other sets.

To bind sets and set push constants
Look at the drawing page for info about vkCmdBindDescriptorSets and vkCmdPushConstants.

Comments