Mesa (master): glsl: Correctly return progress from lower_variable_index_to_cond_assign

Ian Romanick idr at kemper.freedesktop.org
Tue Jul 26 01:56:19 UTC 2011


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Jul 25 18:33:40 2011 -0700

glsl: Correctly return progress from lower_variable_index_to_cond_assign

lower_variable_index_to_cond_assign runs until it can't make any more
progress.  It then returns the result of the last pass which will
always be false.  This caused the lowering loop in
_mesa_ir_link_shader to end before doing one last round of
lower_if_to_cond_assign.  This caused several if-statements (resulting
from lower_variable_index_to_cond_assign) to be left in the IR.

In addition to this change, lower_variable_index_to_cond_assign should
take a flag indicating whether or not it should even generate
if-statements.  This is easily controlled by
switch_generator::linear_sequence_max_length.  This would generate
much better code on architectures without any flow contol.

Fixes i915 piglit regressions glsl-texcoord-array and
glsl-fs-vec4-indexing-temp-src.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/lower_variable_index_to_cond_assign.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp
index 7792e6e..f8e4a1d 100644
--- a/src/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/glsl/lower_variable_index_to_cond_assign.cpp
@@ -525,10 +525,12 @@ lower_variable_index_to_cond_assign(exec_list *instructions,
     * matrix columns of an array of matrix), each pass will only lower one
     * level of indirection.
     */
+   bool progress_ever = false;
    do {
       v.progress = false;
       visit_list_elements(&v, instructions);
+      progress_ever = v.progress || progress_ever;
    } while (v.progress);
 
-   return v.progress;
+   return progress_ever;
 }




More information about the mesa-commit mailing list