summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-12-31 13:42:09 +0100
committerMarek Olšák <[email protected]>2017-01-05 13:07:12 +0100
commit0a5018c1a483abe6c4dddc6c65a7f4e939efc726 (patch)
tree17a58572cfb31f921c54399c5b28b1434cff0532 /src/compiler/glsl/linker.cpp
parente51baeb6c1386681d8f9c285a8f4912d91fad7ee (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/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index f4f918a34e7..13fbb30b27b 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -5048,10 +5048,18 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
lower_tess_level(prog->_LinkedShaders[i]);
}
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
- &ctx->Const.ShaderCompilerOptions[i],
- ctx->Const.NativeIntegers))
- ;
+ if (ctx->Const.GLSLOptimizeConservatively) {
+ /* Run it just once. */
+ do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
+ &ctx->Const.ShaderCompilerOptions[i],
+ ctx->Const.NativeIntegers);
+ } else {
+ /* Repeat it until it stops making changes. */
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
+ &ctx->Const.ShaderCompilerOptions[i],
+ ctx->Const.NativeIntegers))
+ ;
+ }
lower_const_arrays_to_uniforms(prog->_LinkedShaders[i]->ir, i);
propagate_invariance(prog->_LinkedShaders[i]->ir);