[Mesa-dev] [PATCH] mesa/shader: return correct attribute location for double matrix arrays
Tapani Pälli
tapani.palli at intel.com
Wed Dec 9 22:43:13 PST 2015
On 12/10/2015 05:41 AM, 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.
>
> 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;
There are some lines that exceed 80 chars in this file but this seems
way too long (?) You could put this case in braces and have a temporary
for glsl_type or maybe matrix cols to make it fit. Otherwise seems
correct to me. Looks like this has been broken for quite a long time,
even before program interface query was introduced.
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
> case GL_PROGRAM_OUTPUT:
> /* If the output is an array, fail if the index is out of bounds. */
> if (array_index > 0
>
// Tapani
More information about the mesa-dev
mailing list