glsl: Only flag RowMajor on matrix-type variables.
authorEric Anholt <eric@anholt.net>
Mon, 23 Jul 2012 21:31:42 +0000 (14:31 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 7 Aug 2012 20:54:50 +0000 (13:54 -0700)
We were only propagating it to the API when the variable was a matrix type,
but we were still tripping over it in lower_ubo_reference when it was set on a
vector.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 1c54991cf7423f4164b6dd69de4846a4c2c907ed..02fe66b6012bc5107ce294a50b810e7027e86272 100644 (file)
@@ -4054,11 +4054,15 @@ ast_uniform_block::hir(exec_list *instructions,
         ubo_var->Type = var->type;
         ubo_var->Buffer = ubo - state->uniform_blocks;
         ubo_var->Offset = 0; /* Assigned at link time. */
-        ubo_var->RowMajor = block_row_major;
-        if (decl_list->type->qualifier.flags.q.row_major)
-           ubo_var->RowMajor = true;
-        else if (decl_list->type->qualifier.flags.q.column_major)
-           ubo_var->RowMajor = false;
+
+        if (var->type->is_matrix() ||
+            (var->type->is_array() && var->type->fields.array->is_matrix())) {
+           ubo_var->RowMajor = block_row_major;
+           if (decl_list->type->qualifier.flags.q.row_major)
+              ubo_var->RowMajor = true;
+           else if (decl_list->type->qualifier.flags.q.column_major)
+              ubo_var->RowMajor = false;
+        }
 
         /* From the GL_ARB_uniform_buffer_object spec:
          *