Search code examples
copengl

OpenGL: Cannot find GL_MAX_UNIFORM_BUFFERS and similar macro definitions


In OpenGL Superbible 5th edition, at the Uniform Buffer Objects part, it says this:

There is fixed maximum number of uniform blocks that can be used by a single program, and a maximum number that can be used in any given shader stage. You can find these limits by calling glGetIntegerv with the GL_MAX_UNIFORM_BUFFERS parameter (for the total per program) and either GL_MAX_VERTEX_UNIFORM_BUFFERS, GL_MAX_GEOMETRY_UNIFORM_BUFFERS, or GL_MAX_FRAGMENT_UNIFORM_BUFFERS for the vertex, geometry, and fragment shader limits, respectively.

I've also found references to these in the 6th and 7th editions too.

I cannot seem to find these macro definitions anywhere in the "GL/" headers, nor in the Khronos documentations, nor in any search engines.

Is this an editorial error that survived multiple editions of the book, or am I missing something (less?) obvious detail while trying to find it?


Solution

  • I think that these are simply errors in the Superbible series, which appear to be the only sources that mention these constants. The OpenGL 4.5 Core specification itself states in section 7.6.2:

    There is a set of implementation-dependent maximums for the number of active uniform blocks used by each shader stage. [...] The limits for vertex, tessellation control, tessellation evaluation, geometry, fragment, and compute shaders can be obtained by calling GetIntegerv with pname values of MAX_VERTEX_UNIFORM_BLOCKS, MAX_TESS_CONTROL_UNIFORM_BLOCKS, MAX_TESS_EVALUATION_UNIFORM_BLOCKS, MAX_GEOMETRY_UNIFORM_BLOCKS, MAX_FRAGMENT_UNIFORM_BLOCKS, and MAX_COMPUTE_UNIFORM_BLOCKS, respectively.

    Naturally, these constants should be prefixed with GL_ in code.