I'll start with a bit context about VkDescriptorSetLayoutBinding
and answer your question afterwards.
VkDescriptorSetLayoutBinding
allows to describe not only one resource, but an array of resources.
Let's assume that you did not want to use only one texture in a GLSL shader:
layout(set = 0, binding = 0) uniform sampler2D texture;
but an array of textures:
layout(set = 0, binding = 0) uniform sampler2D textures[];
you'd create a VkDescriptorSetLayoutBinding
with multiple texture descriptors, e.g. like follows:
VkDescriptorSetLayoutBinding dsLayout = {};
dsLayout.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
dsLayout.descriptorCount = 100u;
With VkWriteDescriptorSet
you write the actual resource information to the GPU, s.t. your shaders know where they can "find" the resource on the GPU... or maybe more accurate: how they can access a certain resource.
If you wanted to write all 100
texture descriptors at once, you'd set the following data:
VkWriteDescriptorSet write = {};
write.dstArrayElement = 0u;
write.descriptorCount = 100u;
But if only the 70th texture has changed, you'd like to update only that one with:
VkWriteDescriptorSet write = {};
write.dstArrayElement = 69u;
write.descriptorCount = 1u;
So, to answer your question: dstArrayElement
refers to the array of descriptors defined in VkDescriptorSetLayoutBinding
. There will be many cases where VkDescriptorSetLayoutBinding
only describes one descriptor (one could also say: an array of length 1), but if you use one VkDescriptorSetLayoutBinding
to describe an array of resources, you might not always want to update all of them, but only one (or a few) by specifying an offset into the array of descriptors via dstArrayElement
.
Btw.: VkDescriptorSetLayoutBinding
and VkWriteDescriptorSet
are linked to the same resource via its binding
and dstBinding
members, respectively.