Creating a descriptor set layout
Descriptor sets gather many resources (descriptors) in one object. They are later bound to a pipeline to establish an interface between our application and the shaders. But for the hardware to know what resources are grouped in a set, how many resources of each type there are, and what their order is, we need to create a descriptor set layout.
How to do it...
- Take the handle of a logical device and assign it to a variable of type
VkDevice
namedlogical_device
. - Create a vector variable with elements of type
VkDescriptorSetLayoutBinding
and call itbindings
. - For each resource you want to create and assign later to a given descriptor set, add an element to the
bindings
vector. Use the following values for members of each new element:- The selected index of the given resource within a descriptor set for
binding
. - Desired type of a given resource for
descriptorType
- The number of resources of a specified type accessed through an array inside the shader (or 1 if the given...
- The selected index of the given resource within a descriptor set for