Now that I understand (say almost) how to render a simple triangle, I’d like to render textures. But there is a problem. Scenes could (and generally they do) have several textures. Since Vulkan does not support bindless (and I suppose it is intented because if bindless exists, it is because it was costly to bind something in OpenGL. But in Vulkan not, so there is no need to use bindless), we should think how manage texture in a different way.
In OpenGL it was simple, Vulkan made me think a lot about it.
It comes to me (generally from the internet and spec) several ideas to render a mesh with a lot of textures.
[/li][li]use texture/sampler Array
The first idea is not a good one, since it is not allowed by Vulkan to update a used descriptorSets. And it should be slow to update all the descriptor several times.
The second idea is still about descriptorSets, but the idea here is to have a lot of descriptorSets (say one by texture)
The third one is not especially portable since it requires “SampledImageArrayDynamicIndexing” or use a tricky technics with push constants
So, according to me, the better idea is to use the second one, and I guess a vkBindDescriptorSet is not a heavy operation (but if I am wrong, tell me ^^).
Now that we have pointed out what the context is, we can go into the problem.
We have to tell Vulkan how much resources the pool need. But for example, if I need 1 000 descriptor sets? Is there a way to resize the pool? Or should we fix a size at the beginning?
When we are reading the doc, it is said : “maxPerStageDescriptorUniformBuffers is the maximum number of uniform buffers that can be accessible to a single shader stage in a pipeline layout”.
I understand that the total number of descriptorSet is “unlimited”. That’s it my idea which was to allocate a lot of descriptor sets was a good idea, and if the pool is running out of memory, we could create another one and use vkCopyDescriptorSet?
Was my reasonning good?