Question about specification

In the specification about structure VkWriteDescriptorSet

dstArrayElement is the starting element in that array.

which array this statement is refering to?

The descriptor array. Some descriptors can be arrayed; they can have multiple elements each representing a separate resource, that are all accessed through a single descriptor set+binding.

If you’re dealing with a non-arrayed descriptor, then this value should be 0, and the corresponding count should be 1.

Thank you,Alfonse_Reinheart,could you help me to just clarify it with the following example so I can make sure my understanding is correct

	VkDescriptorBufferInfo descriptorBufferInfo[3] = { bufferInfo0 ,bufferInfo1, bufferInfo2 };

		std::array<VkWriteDescriptorSet, 2> writeDescriptorSets{};

			Binding 0: Object matrices Uniform buffer
		writeDescriptorSets[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
		writeDescriptorSets[0].dstSet = descriptorSets[i];
		writeDescriptorSets[0].dstBinding = 0;
		writeDescriptorSets[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
		writeDescriptorSets[0].pBufferInfo = descriptorBufferInfo;
		writeDescriptorSets[0].descriptorCount = 2;
		writeDescriptorSets[0].dstArrayElement = 1;

Does this mean that writeDescriptorSets[0] has two descriptors,bufferInfo1 and bufferInfo2?

No. This is referring to the array of descriptors in the shader. The definition of the descriptor from set descriptorSets[i], with binding 0 will have array indices 1 and 2 filled in by the first two elements of descriptorBufferInfo.

1 Like

I do some expriment and finally understand it,it is refering to the index of descriptors declaring using vkDescriptorSetLayoutBinding.Thank you