diff options
author | Marek Olšák <[email protected]> | 2016-12-31 13:42:09 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-01-05 13:07:12 +0100 |
commit | 0a5018c1a483abe6c4dddc6c65a7f4e939efc726 (patch) | |
tree | 17a58572cfb31f921c54399c5b28b1434cff0532 /src/compiler/glsl/glsl_parser_extras.cpp | |
parent | e51baeb6c1386681d8f9c285a8f4912d91fad7ee (diff) |
mesa: add gl_constants::GLSLOptimizeConservatively
to reduce the amount of GLSL optimizations for drivers that can do better.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser_extras.cpp')
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index b12cf3d90c0..e97cbf4b826 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1949,12 +1949,20 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, assign_subroutine_indexes(shader, state); lower_subroutine(shader->ir, state); + /* 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, options, - ctx->Const.NativeIntegers)) - ; + if (ctx->Const.GLSLOptimizeConservatively) { + /* Run it just once. */ + do_common_optimization(shader->ir, false, false, options, + ctx->Const.NativeIntegers); + } else { + /* Repeat it until it stops making changes. */ + while (do_common_optimization(shader->ir, false, false, options, + ctx->Const.NativeIntegers)) + ; + } validate_ir_tree(shader->ir); |