I’m wondering if anyone has any thoughts on whether it’s fine to use instanced rendering for all meshes or not.
In my application, I render a non instanced mesh like so
vkCmdBindIndexBuffer(...) //Bind indices
vkCmdBindVertexBuffers(...)//Bind vertex attributes like position, normal & color
vkCmdBindDescriptorSets(...) //Bind a single model matrix & other mesh properties
vkCmdDrawIndexed(...) //Instance count is 1
and an instanced mesh like
vkCmdBindIndexBuffer(...) //Bind indices
vkCmdBindVertexBuffers(...)//Bind vertex attributes like position, normal & color
vkCmdBindVertexBuffers(...) //Bind a set of model matrices, one per instance
vkCmdBindDescriptorSets(...) //Bind mesh properties
vkCmdDrawIndexed(...) //Instance count is variable
So the only difference is an extra vkCmdBindVertexBuffers
and obviously the instance count would be a variable in the vkCmdDrawIndexed
command. Would it be reasonable to use the second approach for everything, even for meshes that will only have one instance? It would really simplify my rendering logic because I would not need to maintain two separate pipelines, shaders, etc… Or is there too much performance overhead involved with doing things that way?
In the past the answer to something like this would have been more obvious, but what’s the modern day consensus on this with the Vulkan API?