Doubts with the uniform dynamic buffers

Hello,

I have a question with the dynamic buffers, i have checked my GPU and in the limits i have “maxDescriptorSetUniformBuffersDynamic 8” This limit of 8 Descriptor Sets are for each Pipeline, for each logical device or for each physical device?

What if you want to have a shader with more than 8 separate uniform inputs (without being inside a struct)?

Regarts!

You can really just search the standard for this. It’s pretty clear:

maxDescriptorSetUniformBuffersDynamic is the maximum number of dynamic uniform buffers that can be included in a pipeline layout. Descriptors with a type of VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC count against this limit.

Why would you want that? You’re using Vulkan, not OpenGL. UBOs are the standard mechanism for providing uniform data, not individual uniform variables. That means you’re supposed to collect them into logical groupings called blocks, each of which maps to a particular uniform buffer descriptor resource.

This seems to be a case of designing yourself into a problem, where you only have a problem because you’ve arbitrarily discarded all of the solutions to it. Put your uniforms in meaningful blocks. If you have more than 8 uniforms, then it’s highly likely that there is some correspondance between those uniforms. Uniforms dealing with lighting vs. uniforms dealing with camera and perspective vs. uniforms dealing with object model-to-camera transforms.

It should also be noted that you don’t need to make everything a dynamic uniform buffer. You only need to use them for uniform data that changes frequently (such as on a per-object basis).