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

Author: Eric Anholt <e...@anholt.net>
Date:   Mon Apr 16 09:45:07 2012 -0700

glsl: Don't allow array splitting on function arguments.

This is the reason the declaration member existed in the reference
visitor, but I didn't copy the code from structure splitting that
avoided setting it.

This wasn't currently a problem, because we don't allow splitting of
in/out variables.  But that would be nice to change some day.

Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>

---

 src/glsl/opt_array_splitting.cpp |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp
index 73b35b5..67733ca 100644
--- a/src/glsl/opt_array_splitting.cpp
+++ b/src/glsl/opt_array_splitting.cpp
@@ -65,7 +65,11 @@ public:
    /** Whether this array should be split or not. */
    bool split;
 
-   bool declaration; /* If the variable had a decl in the instruction stream */
+   /* If the variable had a decl we can work with in the instruction
+    * stream.  We can't do splitting on function arguments, which
+    * don't get this variable set.
+    */
+   bool declaration;
 
    ir_variable **components;
 
@@ -99,6 +103,7 @@ public:
    virtual ir_visitor_status visit(ir_variable *);
    virtual ir_visitor_status visit(ir_dereference_variable *);
    virtual ir_visitor_status visit_enter(ir_dereference_array *);
+   virtual ir_visitor_status visit_enter(ir_function_signature *);
 
    variable_entry *get_variable_entry(ir_variable *var);
 
@@ -183,6 +188,17 @@ 
ir_array_reference_visitor::visit_enter(ir_dereference_array *ir)
    return visit_continue_with_parent;
 }
 
+ir_visitor_status
+ir_array_reference_visitor::visit_enter(ir_function_signature *ir)
+{
+   /* We don't have logic for array-splitting function arguments,
+    * so just look at the body instructions and not the parameter
+    * declarations.
+    */
+   visit_list_elements(this, &ir->body);
+   return visit_continue_with_parent;
+}
+
 bool
 ir_array_reference_visitor::get_split_list(exec_list *instructions,
                                           bool linked)

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to