vkUpdateDescriptorSets in case of instancing

Hello guys! Could you please explain why in case of instancing in Sascha Willems VULKAN examples we are not calling vkUpdateDescriptorSets for buffer(instanceBuffer.buffer) which contains instance rotate/translation/scale?

If I try to do it the I am getting error

vkUpdateDescriptorSets(): pDescriptorWrites[0].pBufferInfo[0].buffer was created with VK_BUFFER_USAGE_2_TRANSFER_DST_BIT_KHR|VK_BUFFER_USAGE_2_VERTEX_BUFFER_BIT_KHR, but descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER. The Vulkan spec states: If descriptorType is VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER or VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, the buffer member of each element of pBufferInfo must have been created with VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT set

I’m not familiar with the tutorial in question, but given the usage flags, this buffer is intended for use with vertex data. It’s not a uniform buffer; it’s not access directly by the shader as a shader resource, so it is not a descriptor. You bind it with vkCmdBindVertexBuffers.

1 Like

This buffer is not VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT. It is created as VK_BUFFER_USAGE_VERTEX_BUFFER_BIT. And it means that I do not need to link this buffer to VkDescriptorSet? And at the same time I can get buffer data in shader through location which I define in VkVertexInputBindingDescription and VkVertexInputAttributeDescription for my VkPipeline?

Exactly. Per-instance data as passed a vertex data in that sample (with per-instance rate). And you don’t need descriptors for vertex buffers.

1 Like

Great! Thanks a lot ))))) Your examples are very helpfull