I have multiple meshes with different textures/ pipeline constructs such as depth test/ blending functions to render with vulkan. What are the best practices for rendering them in terms of performance.
One option is create n command buffers with n threads for n meshes with nothing is shared between them, layout, descriptors, samplers, or anything. if i go with this should i be using n secondary command buffers and 1 primary or all of them would be secondary ?
Use the same command buffer to render n meshes, create n pipelines, n buffers for uniforms and vertex data. start recording command buffer and then in the loop, call vkcmdDraw for n meshes with different pipeline, buffers. I am able to render with this approach. but how do i use multithreading to make it faster?
Or any other approach?
- if we are going to share anything between rendering of 2 meshes, then we need synchronization.
You don't; if everything you share is read-only then you don't need synchronization. The only time you need sync between meshes is if one writes to memory and another mesh reads from it. The state of the pipeline and the color attachments are synchronized by the implementation so you don't have to worry about that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With