[Mesa-dev] [PATCH 19/36] glsl: Add default matrix ordering in lower_buffer_access

Jordan Justen jordan.l.justen at intel.com
Sat Nov 14 13:43:55 PST 2015


For compute shader shared variable we will set a default of column
major.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/glsl/lower_buffer_access.cpp | 5 +++--
 src/glsl/lower_buffer_access.h   | 9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/glsl/lower_buffer_access.cpp b/src/glsl/lower_buffer_access.cpp
index 87f64a9..8beec0d 100644
--- a/src/glsl/lower_buffer_access.cpp
+++ b/src/glsl/lower_buffer_access.cpp
@@ -370,8 +370,9 @@ lower_buffer_access::is_dereferenced_thing_row_major(const ir_rvalue *deref)
 
          switch (matrix_layout) {
          case GLSL_MATRIX_LAYOUT_INHERITED:
-            assert(!matrix);
-            return false;
+            assert(default_matrix_layout != GLSL_MATRIX_LAYOUT_INHERITED ||
+                   !matrix);
+            return default_matrix_layout == GLSL_MATRIX_LAYOUT_ROW_MAJOR;
          case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
             return false;
          case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
diff --git a/src/glsl/lower_buffer_access.h b/src/glsl/lower_buffer_access.h
index 77cf180..5562870 100644
--- a/src/glsl/lower_buffer_access.h
+++ b/src/glsl/lower_buffer_access.h
@@ -39,6 +39,14 @@ namespace lower_buffer_access {
 
 class lower_buffer_access : public ir_rvalue_enter_visitor {
 public:
+   lower_buffer_access() :
+      default_matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED)
+   {}
+
+   lower_buffer_access(enum glsl_matrix_layout default_matrix_layout) :
+      default_matrix_layout(default_matrix_layout)
+   {}
+
    virtual void
    insert_buffer_access(ir_dereference *deref, const glsl_type *type,
                         ir_rvalue *offset, unsigned mask, int channel) = 0;
@@ -56,6 +64,7 @@ public:
                             unsigned packing);
 
    void *mem_ctx;
+   enum glsl_matrix_layout default_matrix_layout;
 };
 
 } /* namespace lower_buffer_access */
-- 
2.6.2



More information about the mesa-dev mailing list