[Mesa-dev] [PATCH 1/6] main: fix ACTIVE_UNIFORM_BLOCKS value

Samuel Iglesias Gonsalvez siglesias at igalia.com
Fri Sep 25 01:24:45 PDT 2015


NumUniformBlocks also counts shader storage blocks.
NumUniformBlocks variable will be renamed in a later patch to avoid
misunderstandings.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---
 src/mesa/main/shaderapi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index edc23bc..7866a20 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -725,12 +725,17 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       *params = max_len;
       return;
    }
-   case GL_ACTIVE_UNIFORM_BLOCKS:
+   case GL_ACTIVE_UNIFORM_BLOCKS: {
+      unsigned i;
+
       if (!has_ubo)
          break;
 
-      *params = shProg->NumUniformBlocks;
+      for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++)
+         if (shProg->ProgramResourceList[i].Type == GL_UNIFORM_BLOCK)
+            (*params)++;
       return;
+   }
    case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
       /* This enum isn't part of the OES extension for OpenGL ES 2.0.  It is
        * only available with desktop OpenGL 3.0+ with the
-- 
2.1.4



More information about the mesa-dev mailing list