[Mesa-dev] [PATCH 02/16] glsl: Reorder optimization-passes

Thomas Helland thomashelland90 at gmail.com
Sun Nov 16 17:51:47 PST 2014


This allows opt_algebraic to resolve open-coded
saturates into ir_unop_saturate before we potentially
mess it up by removing the min or max in min/max-pruning.

Since we are now emitting more free saturates on i965
this gives us some decrease in instructions.

total instructions in shared programs: 1317459 -> 1317065 (-0.03%)
instructions in affected programs:     4084 -> 3690 (-9.65%)
GAINED:                                0
LOST:                                  0

---
Two purpose-written shaders are hurt by this.
They exercise the lack of saturate in the get_range
function in minmax_pruning.
This will get sorted out later in the series by
adding saturate to the get_range function.
---
 src/glsl/glsl_parser_extras.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 27e3301..5c98df5 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -1619,10 +1619,10 @@ do_common_optimization(exec_list *ir, bool linked,
    else
       progress = do_constant_variable_unlinked(ir) || progress;
    progress = do_constant_folding(ir) || progress;
+   progress = do_algebraic(ir, native_integers, options) || progress;
    progress = do_minmax_prune(ir) || progress;
    progress = do_cse(ir) || progress;
    progress = do_rebalance_tree(ir) || progress;
-   progress = do_algebraic(ir, native_integers, options) || progress;
    progress = do_lower_jumps(ir) || progress;
    progress = do_vec_index_to_swizzle(ir) || progress;
    progress = lower_vector_insert(ir, false) || progress;
-- 
2.0.3



More information about the mesa-dev mailing list