[Mesa-dev] [PATCH] mesa: Fix glGetProgramiv(GL_ACTIVE_ATTRIBUTES).

Tapani tapani.palli at intel.com
Tue Apr 28 21:47:50 PDT 2015


Argh, this is exactly what I had in mind and I did it with 
_mesa_longest_attribute_name_length but forgot it in 
_mesa_count_active_attribs ... many thanks for catching this. I agree on 
the assertion change, that is simple and will make these bugs much 
easier to catch.

My overall plan is to go further to get rid of ir_variable usage 
completely and have only the required bits of it, this is still WIP though.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 04/28/2015 11:56 PM, Jose Fonseca wrote:
> It's returning random values, because RESOURCE_VAR() is casting
> different objects into ir_variable pointers.
>
> This updates _mesa_count_active_attribs to filters the resources with
> the same logic used in _mesa_longest_attribute_name_length.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=90207
>
> P.S.: RESOURCE_VAR cast helper should have assertions to catch this.
> ---
>   src/mesa/main/shader_query.cpp | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index a84ec84..d2ca49b 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -302,8 +302,10 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
>      struct gl_program_resource *res = shProg->ProgramResourceList;
>      unsigned count = 0;
>      for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
> -         if (is_active_attrib(RESOURCE_VAR(res)))
> -            count++;
> +      if (res->Type == GL_PROGRAM_INPUT &&
> +          res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
> +          is_active_attrib(RESOURCE_VAR(res)))
> +         count++;
>      }
>      return count;
>   }



More information about the mesa-dev mailing list