I currently create one pipelineLayout
per different pipeline I need. So far I have one for my meshes using classic TRIANGLE_LIST
drawing and another to draw some lines with LINE_LIST
.
To create my pipelineLayouts
I have one DescriptorSetLayout
per shader (for now its also matching the number of desired pipeline layouts) and each DescriptorSetLayout
is duplicated to have one per object to draw with this shader.
Example :
To draw 2 cubes and 3 lines I have 2 pipelineLayouts, the first one with 2 DescriptorSetLayout and the second with 3.
The problem is that if I try to draw more than a few objects using the same layout I hit the maxBoundDescriptorSets
limit which for my device is 32.
So far the only solution I found is to duplicate my pipelineLayouts
to only have at most maxBoundDescriptorSets
per pipelineLayout
.
Are there other solutions ? If so what is the best one ?
The maxBoundDescriptorSets
limit defines the maximum number of concurrently bound descriptor sets you can have. You can have more than this in total, you just can't have them all bound at the same time.
You can reuse the same descriptor set indices for different descriptor sets for each draw command. For example. use descriptor set 0 for per level resources that you never change, and set 1 for per object resources things you change per invocation. You need to change the descriptor set bound to the set 1 index for each draw, but changing the bound set is an inexpensive operation and expected to be done frequently.