glsl: Drop do_common_optimization's max_unroll_iterations parameter.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 8 Apr 2014 22:43:46 +0000 (15:43 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 12 Apr 2014 00:41:37 +0000 (17:41 -0700)
Now that we pass in gl_shader_compiler_options, it makes sense to just
use options->MaxUnrollIterations, rather than passing a separate
parameter.

Half of the invocations already passed options->MaxUnrollIterations,
while the other half passed in a hardcoded value of 32.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/glsl_parser_extras.cpp
src/glsl/ir_optimization.h
src/glsl/linker.cpp
src/glsl/test_optpass.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/main/ff_fragment_shader.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index a42f3d23df0e01940c56a4f986aa8cdcab82325f..1fcd5f8ca0a69a1effa980e276fff3d10ae2c61c 100644 (file)
@@ -1444,7 +1444,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
       /* Do some optimization at compile time to reduce shader IR size
        * and reduce later work if the same shader is linked multiple times
        */
-      while (do_common_optimization(shader->ir, false, false, 32, options,
+      while (do_common_optimization(shader->ir, false, false, options,
                                     ctx->Const.NativeIntegers))
          ;
 
@@ -1492,7 +1492,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
 bool
 do_common_optimization(exec_list *ir, bool linked,
                       bool uniform_locations_assigned,
-                      unsigned max_unroll_iterations,
                        const struct gl_shader_compiler_options *options,
                        bool native_integers)
 {
@@ -1543,7 +1542,7 @@ do_common_optimization(exec_list *ir, bool linked,
    loop_state *ls = analyze_loop_variables(ir);
    if (ls->loop_found) {
       progress = set_loop_controls(ir, ls) || progress;
-      progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+      progress = unroll_loops(ir, ls, options->MaxUnrollIterations) || progress;
    }
    delete ls;
 
index 665124a7d307199286cfaa18eb9d652f4fcfc089..40bb61392851d0084aa5139666ce1730ba773a94 100644 (file)
@@ -66,7 +66,6 @@ enum lower_packing_builtins_op {
 
 bool do_common_optimization(exec_list *ir, bool linked,
                            bool uniform_locations_assigned,
-                           unsigned max_unroll_iterations,
                             const struct gl_shader_compiler_options *options,
                             bool native_integers);
 
index 7c194a26a3687f86e56884af6b92141ef7bd5c6a..c8dc0661dfda07e1ccb094fe9b5dda47fd0ef38c 100644 (file)
@@ -2296,10 +2296,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
          lower_clip_distance(prog->_LinkedShaders[i]);
       }
 
-      unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
-
       while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
-                                    max_unroll, &ctx->ShaderCompilerOptions[i],
+                                    &ctx->ShaderCompilerOptions[i],
                                     ctx->Const.NativeIntegers))
         ;
    }
index 79fb17a9e4c1af54aa774ed1ed5eaa8b74218b66..db5cb266207a6af2786900db900be05f31b1f675 100644 (file)
@@ -62,9 +62,8 @@ do_optimization(struct exec_list *ir, const char *optimization,
    int int_3;
    int int_4;
 
-   if (sscanf(optimization, "do_common_optimization ( %d , %d ) ",
-              &int_0, &int_1) == 2) {
-      return do_common_optimization(ir, int_0 != 0, false, int_1, options, true);
+   if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) {
+      return do_common_optimization(ir, int_0 != 0, false, options, true);
    } else if (strcmp(optimization, "do_algebraic") == 0) {
       return do_algebraic(ir, true);
    } else if (strcmp(optimization, "do_constant_folding") == 0) {
index 7a6cd7c17f2646803340a11fad4a13c8d8325cac..c32e66c9f80ab87b9ff210e6babc61db60fc95c3 100644 (file)
@@ -200,7 +200,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
                                   false /* loops */
                                   ) || progress;
 
-        progress = do_common_optimization(shader->base.ir, true, true, 32,
+        progress = do_common_optimization(shader->base.ir, true, true,
                                            options, ctx->Const.NativeIntegers)
           || progress;
       } while (progress);
index e41dcefb0c66c5b3ac577f9a610461641157147d..66c18fa1670e5e26e8b9335657efdef6856435e9 100644 (file)
@@ -1344,7 +1344,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
    const struct gl_shader_compiler_options *options =
       &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
 
-   while (do_common_optimization(p.shader->ir, false, false, 32, options,
+   while (do_common_optimization(p.shader->ir, false, false, options,
                                  ctx->Const.NativeIntegers))
       ;
    reparent_ir(p.shader->ir, p.shader->ir);
index 675e58e2a9733ebc38c63527778e670ed58d1fdb..59cf1232ad0830dfb41c48b92aad7c4d2ca4a07b 100644 (file)
@@ -3007,7 +3007,6 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
         progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
 
         progress = do_common_optimization(ir, true, true,
-                                          options->MaxUnrollIterations,
                                            options, ctx->Const.NativeIntegers)
           || progress;
 
index 28e8f1ecbc592c0916c6a797e1548058f16af9a9..edd0aa7658db6657be600d1d634376f8dbc99f85 100644 (file)
@@ -5357,9 +5357,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
          progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
 
-         progress = do_common_optimization(ir, true, true,
-                                          options->MaxUnrollIterations,
-                                           options,
+         progress = do_common_optimization(ir, true, true, options,
                                            ctx->Const.NativeIntegers)
           || progress;