I have several meshes that use several pipelines and that can be turned on or off using UI commands.
Right now, I have the pipeline binding, the render-pass creation, the buffer binding and the draw commands of all the meshes in the same command group.
I re-create the commands when the user switch on or off a mesh.
It works.
I tried to split the commands in several command buffers, using several command groups when submitting the commands.
The validation layer don’t like that, nor vulkan itself. It says that draw commands (CmdDrawIndexed), the pipeline binding and the render pass have to be in the same command group.
My approach is not the right approach. Any advice?
And what about culling. the command group has to be reset and repopulated each frame?
What are “command groups”, and how are those different from “command buffers”?
How did you “split the commands in several command buffers”? If you’re dividing commands that all go within the same renderpass, did you properly put them in secondary command buffers and do all of the other stuff needed to make that work?
When you “split the commands in several command buffers”, did you make sure to reset any state that those commands depend on? CBs don’t inherit state between them, so if you bind a pipeline or descriptors in one CB, later CBs have no idea that this happened.
It seems to me that you wrote buggy code somewhere, but without seeing the code, we can’t really help you.