Mesa (master): mesa: Add support for most of the other pnames of glGetActiveUniformBlockiv().

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 31 19:21:41 UTC 2012


Module: Mesa
Branch: master
Commit: dc654370c39d6597b63ff469fc79aa1c22c079fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc654370c39d6597b63ff469fc79aa1c22c079fe

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jun 19 14:29:49 2012 -0700

mesa: Add support for most of the other pnames of glGetActiveUniformBlockiv().

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/uniforms.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 3236d6e..6652251 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -643,6 +643,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
    GET_CURRENT_CONTEXT(ctx);
    struct gl_shader_program *shProg;
    struct gl_uniform_block *block;
+   unsigned i;
 
    if (!ctx->Extensions.ARB_uniform_buffer_object) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv");
@@ -668,10 +669,39 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
       params[0] = block->Binding;
       return;
 
+   case GL_UNIFORM_BLOCK_DATA_SIZE:
+      params[0] = block->UniformBufferSize;
+      return;
+
    case GL_UNIFORM_BLOCK_NAME_LENGTH:
       params[0] = strlen(block->Name) + 1;
       return;
 
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+      params[0] = block->NumUniforms;
+      return;
+
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+      for (i = 0; i < block->NumUniforms; i++) {
+	 unsigned offset;
+	 params[i] = _mesa_get_uniform_location(ctx, shProg,
+						block->Uniforms[i].Name,
+						&offset);
+      }
+      return;
+
+   case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+      params[0] = shProg->UniformBlockStageIndex[MESA_SHADER_VERTEX][uniformBlockIndex] != -1;
+      return;
+
+   case GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER:
+      params[0] = shProg->UniformBlockStageIndex[MESA_SHADER_GEOMETRY][uniformBlockIndex] != -1;
+      return;
+
+   case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+      params[0] = shProg->UniformBlockStageIndex[MESA_SHADER_FRAGMENT][uniformBlockIndex] != -1;
+      return;
+
    default:
       _mesa_error(ctx, GL_INVALID_ENUM,
 		  "glGetActiveUniformBlockiv(pname 0x%x (%s))",




More information about the mesa-commit mailing list