Mesa (master): linker: Handle varying arrays, matrices, and arrays of matrices

Ian Romanick idr at kemper.freedesktop.org
Mon Aug 30 23:08:47 UTC 2010


Module: Mesa
Branch: master
Commit: df869d916308759fbacb227f60b1b6eda73131e2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df869d916308759fbacb227f60b1b6eda73131e2

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Aug 30 15:37:44 2010 -0700

linker: Handle varying arrays, matrices, and arrays of matrices

Fixes piglit test case glsl-array-varying-01.

---

 src/glsl/linker.cpp |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 56e0bfd..e0823c3 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1296,15 +1296,24 @@ assign_varying_locations(struct gl_shader_program *prog,
 
       assert(input_var->location == -1);
 
-      /* FINISHME: Location assignment will need some changes when arrays,
-       * FINISHME: matrices, and structures are allowed as shader inputs /
-       * FINISHME: outputs.
-       */
       output_var->location = output_index;
       input_var->location = input_index;
 
-      output_index++;
-      input_index++;
+      /* FINISHME: Support for "varying" records in GLSL 1.50. */
+      assert(!output_var->type->is_record());
+
+      if (output_var->type->is_array()) {
+	 const unsigned slots = output_var->type->length
+	    * output_var->type->fields.array->matrix_columns;
+
+	 output_index += slots;
+	 input_index += slots;
+      } else {
+	 const unsigned slots = output_var->type->matrix_columns;
+
+	 output_index += slots;
+	 input_index += slots;
+      }
    }
 
    demote_unread_shader_outputs(producer);




More information about the mesa-commit mailing list