diff options
author | Eric Anholt <[email protected]> | 2012-06-14 08:57:04 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-07-31 12:06:19 -0700 |
commit | 4070036259555a7791f1bc6a3a161c5a62500a21 (patch) | |
tree | 07e0e994ae19a5be199d11e23850fc05f13e91b3 | |
parent | 3a90dc22d1c74e8719c95221f15043e7f3e69286 (diff) |
mesa: Add support for glGetProgramiv pnames for UBOs.
Fixes piglit ARB_uniform_buffer_object/getprogramiv.
v2: Add extension checks.
v3: Appease MSVC.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/mesa/main/shaderapi.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 7c97a63593f..caeb9657e4c 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -544,6 +544,35 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param *params = shProg->Geom.OutputType; break; #endif + case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: { + unsigned i; + GLint max_len = 0; + + if (!ctx->Extensions.ARB_uniform_buffer_object) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); + return; + } + + for (i = 0; i < shProg->NumUniformBlocks; i++) { + /* Add one for the terminating NUL character. + */ + const GLint len = strlen(shProg->UniformBlocks[i].Name) + 1; + + if (len > max_len) + max_len = len; + } + + *params = max_len; + break; + } + case GL_ACTIVE_UNIFORM_BLOCKS: + if (!ctx->Extensions.ARB_uniform_buffer_object) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); + return; + } + + *params = shProg->NumUniformBlocks; + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); return; |