From b0a4a50c24f90747ed106275758b842f38345271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Mon, 20 Apr 2015 15:41:06 +0300 Subject: [PATCH] mesa: fix query for GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit earlier implementation used NumUniforms directly while query should investigate _active_ uniforms count. Signed-off-by: Tapani Pälli Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90109 --- src/mesa/main/shader_query.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index c7062ab..2a9222c 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -860,7 +860,15 @@ get_buffer_property(struct gl_shader_program *shProg, *val = RESOURCE_UBO(res)->UniformBufferSize; return 1; case GL_NUM_ACTIVE_VARIABLES: - *val = RESOURCE_UBO(res)->NumUniforms; + *val = 0; + for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) { + const char *iname = RESOURCE_UBO(res)->Uniforms[i].IndexName; + struct gl_program_resource *uni = + _mesa_program_resource_find_name(shProg, GL_UNIFORM, iname); + if (!uni) + continue; + (*val)++; + } return 1; case GL_ACTIVE_VARIABLES: for (unsigned i = 0; i < RESOURCE_UBO(res)->NumUniforms; i++) { -- 2.1.0