[Mesa-dev] [PATCH] mesa/shader: return correct attribute location for double matrix arrays

Timothy Arceri timothy.arceri at collabora.com
Wed Dec 9 20:42:33 PST 2015


On Thu, 2015-12-10 at 13:41 +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> If we have a dmat2[4], then dmat2[0] is at 17, dmat2[1] at 19,
> dmat2[2] at 21 etc. The old code was returning 17,18,19.
> 
> I think this code is also wrong for float matricies as well.

Would be good to have a piglit for the float case.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

> 
> This partly fixes:
> GL41-CTS.vertex_attrib_64bit.limits_test
> ---
>  src/mesa/main/shader_query.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/shader_query.cpp
> b/src/mesa/main/shader_query.cpp
> index 5d15006..faaf08c 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -858,7 +858,7 @@ program_resource_location(struct
> gl_shader_program *shProg,
>            && array_index >= RESOURCE_VAR(res)->type->length) {
>           return -1;
>        }
> -      return RESOURCE_VAR(res)->data.location + array_index -
> VERT_ATTRIB_GENERIC0;
> +      return RESOURCE_VAR(res)->data.location + (array_index *
> RESOURCE_VAR(res)->type->without_array()->matrix_columns) -
> VERT_ATTRIB_GENERIC0;
>     case GL_PROGRAM_OUTPUT:
>        /* If the output is an array, fail if the index is out of
> bounds. */
>        if (array_index > 0


More information about the mesa-dev mailing list