I'm about to implement some functionality which will use uniform buffer objects, and I'm trying to understand the limitations of UBOs before doing so.
For example let's use these GL_MAX_*
values and this simple fragment shader:
- GL_MAX_UNIFORM_BUFFER_BINDINGS -> 84
- GL_MAX_UNIFORM_BLOCK_SIZE -> 16384
- GL_MAX_VERTEX_UNIFORM_BLOCKS -> 14
#version 330 core
layout (location = 0) in vec3 aPos;
// UBO
layout (std140, binding = 0) uniform Matrices
{
mat4 projection;
mat4 view;
};
// Individual uniform variables
uniform mat4 model;
uniform vec3 camPos;
void main()
{
gl_Position = projection * view * model * vec4(aPos, 1.0);
}
Questions:
GL_MAX_VERTEX_UNIFORM_BLOCKS
, or is there a default uniform block where these variables are stored (I'm guessing the later)?GL_MAX_UNIFORM_BLOCK_SIZE
the limit for all defined uniform blocks, or does each defined UBO have a max size of this parameter making in this example the max amount of uniform data allowed to be passed to the shader program 229,376 bytes (spread across multiple ubos)?GL_MAX_UNIFORM_BUFFER_BINDINGS
parameter, leaving 81 available binding locations in this example?Uniforms not declared in a block do not count against any uniform block limits. Nor do uniform block limits apply to them; non-block uniforms have their own, separate limitations.
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