From da22221aa365923e033a65c1fbe19ed27301d000 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 8 Apr 2014 15:43:46 -0700 Subject: glsl: Drop do_common_optimization's max_unroll_iterations parameter. 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 Reviewed-by: Eric Anholt --- src/glsl/glsl_parser_extras.cpp | 5 ++--- src/glsl/ir_optimization.h | 1 - src/glsl/linker.cpp | 4 +--- src/glsl/test_optpass.cpp | 5 ++--- 4 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index a42f3d23df0..1fcd5f8ca0a 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -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; diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 665124a7d30..40bb6139285 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -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); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 7c194a26a36..c8dc0661dfd 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -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)) ; } diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp index 79fb17a9e4c..db5cb266207 100644 --- a/src/glsl/test_optpass.cpp +++ b/src/glsl/test_optpass.cpp @@ -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) { -- cgit v1.2.3