summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-12-10 11:44:34 +1000
committerDave Airlie <airlied@redhat.com>2015-12-11 16:28:29 +1000
commit18ad641c3b2e926b8b3e2bd1df31fa739624cbe4 (patch)
tree626af22bbc4ed662945cfb159e8adfbbecb0e1e1 /src/mesa/main/shader_query.cpp
parent64c59b06244fc34f015f1f75b8205ac597ab0105 (diff)
downloadexternal_mesa3d-18ad641c3b2e926b8b3e2bd1df31fa739624cbe4.zip
external_mesa3d-18ad641c3b2e926b8b3e2bd1df31fa739624cbe4.tar.gz
external_mesa3d-18ad641c3b2e926b8b3e2bd1df31fa739624cbe4.tar.bz2
mesa/shader: return correct attribute location for double matrix arrays
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. There is now a piglit for the float case. This partly fixes: GL41-CTS.vertex_attrib_64bit.limits_test [airlied: update with Tapani suggestion to clean it up]. Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 5d15006..ced10a9 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -852,13 +852,18 @@ program_resource_location(struct gl_shader_program *shProg,
* and user-defined attributes.
*/
switch (res->Type) {
- case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_INPUT: {
+ const ir_variable *var = RESOURCE_VAR(res);
+
/* If the input is an array, fail if the index is out of bounds. */
if (array_index > 0
- && array_index >= RESOURCE_VAR(res)->type->length) {
+ && array_index >= var->type->length) {
return -1;
}
- return RESOURCE_VAR(res)->data.location + array_index - VERT_ATTRIB_GENERIC0;
+ return (var->data.location +
+ (array_index * var->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