mesa: Allow GL_TEXTURE_CUBE_MAP target with compressed internal formats
[mesa.git] / src / mesa / main / uniforms.c
index f450173af278cef9e7c1171b0c3f481219a2e967..b6512fe6f3b29c2a554db0f1e98b245a8aee124b 100644 (file)
@@ -1089,18 +1089,38 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
       params[0] = strlen(block->Name) + 1;
       return;
 
-   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
-      params[0] = block->NumUniforms;
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: {
+      unsigned count = 0;
+
+      for (i = 0; i < block->NumUniforms; i++) {
+        unsigned offset;
+         const int idx =
+            _mesa_get_uniform_location(ctx, shProg,
+                                       block->Uniforms[i].IndexName,
+                                       &offset);
+         if (idx != -1)
+            count++;
+      }
+
+      params[0] = count;
       return;
+   }
+
+   case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: {
+      unsigned count = 0;
 
-   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].IndexName,
-                                               &offset);
+         const int idx =
+            _mesa_get_uniform_location(ctx, shProg,
+                                       block->Uniforms[i].IndexName,
+                                       &offset);
+
+         if (idx != -1)
+            params[count++] = idx;
       }
       return;
+   }
 
    case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
       params[0] = shProg->UniformBlockStageIndex[MESA_SHADER_VERTEX][uniformBlockIndex] != -1;