Mesa (master): glsl: Remove const decoration from inlined function parameters

Ian Romanick idr at kemper.freedesktop.org
Fri Oct 8 21:38:25 UTC 2010


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Oct  8 14:29:11 2010 -0700

glsl: Remove const decoration from inlined function parameters

The constness of the function parameter gets inlined with the rest of
the function.  However, there is also an assignment to the parameter.
If this occurs inside a loop the loop analysis code will get confused
by the assignment to a read-only variable.

Fixes bugzilla #30552.

NOTE: this is a candidate for the 7.9 branch.

---

 src/glsl/ir_function_inlining.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp
index 874602c..147c182 100644
--- a/src/glsl/ir_function_inlining.cpp
+++ b/src/glsl/ir_function_inlining.cpp
@@ -153,6 +153,13 @@ ir_call::generate_inline(ir_instruction *next_ir)
       } else {
 	 parameters[i] = sig_param->clone(ctx, ht);
 	 parameters[i]->mode = ir_var_auto;
+
+	 /* Remove the read-only decoration becuase we're going to write
+	  * directly to this variable.  If the cloned variable is left
+	  * read-only and the inlined function is inside a loop, the loop
+	  * analysis code will get confused.
+	  */
+	 parameters[i]->read_only = false;
 	 next_ir->insert_before(parameters[i]);
       }
 




More information about the mesa-commit mailing list