[Mesa-dev] [PATCH V6 15/27] i965: add arrays of arrays support for varyings

Timothy Arceri t_arceri at yahoo.com.au
Mon Sep 28 19:42:19 PDT 2015


V2: get the correct vector elements value for outputs
---
 src/mesa/drivers/dri/i965/brw_fs.cpp     | 4 ++--
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a8f5520..7192581 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1062,11 +1062,11 @@ fs_visitor::emit_general_interpolation(fs_reg attr, const char *name,
    unsigned int array_elements;
 
    if (type->is_array()) {
-      array_elements = type->length;
+      array_elements = type->arrays_of_arrays_size();
       if (array_elements == 0) {
          fail("dereferenced array '%s' has length 0\n", name);
       }
-      type = type->fields.array;
+      type = type->without_array();
    } else {
       array_elements = 1;
    }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index a2bc5c6..5bc183c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -81,7 +81,8 @@ fs_visitor::nir_setup_inputs(nir_shader *shader)
          const unsigned components = t->components();
          const unsigned cols = t->matrix_columns;
          const unsigned elts = t->vector_elements;
-         unsigned array_length = var->type->is_array() ? var->type->length : 1;
+         unsigned array_length =
+            var->type->is_array() ? var->type->arrays_of_arrays_size() : 1;
          for (unsigned i = 0; i < array_length; i++) {
             for (unsigned j = 0; j < cols; j++) {
                for (unsigned k = 0; k < elts; k++) {
@@ -127,9 +128,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)
    foreach_list_typed(nir_variable, var, node, &shader->outputs) {
       fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
 
-      int vector_elements =
-         var->type->is_array() ? var->type->fields.array->vector_elements
-                               : var->type->vector_elements;
+      int vector_elements = var->type->without_array()->vector_elements;
 
       switch (stage) {
       case MESA_SHADER_VERTEX:
-- 
2.4.3



More information about the mesa-dev mailing list