On 07/20/2012 04:33 PM, Eric Anholt wrote:
Fixes piglit ARB_uniform_buffer_object/getprogramiv.
---
  src/mesa/main/shaderapi.c |   19 +++++++++++++++++++
  1 file changed, 19 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 6927368..f381915 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -542,6 +542,25 @@ 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;
+
+      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:
+      *params = shProg->NumUniformBlocks;
+      break;
     default:
        _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
        return;

It looks like these new cases (and the existing cases for geometry shaders and transform feedback) need extension tests:

if (!ctx->Extensions.ARB_uniform_buffer_object) {
   _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv");
   return;
}

Since there would be a quite a few of these, a goto-error handler at the end of the function would be good.

-Brian
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to