On 12/10/2015 05:41 AM, Dave Airlie wrote:
From: Dave Airlie <airl...@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.pa...@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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to