aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp10
-rw-r--r--src/mesa/main/mtypes.h7
2 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index fd2c71f93ee..48b84e8fd73 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1254,9 +1254,13 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
const struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
- while (do_common_optimization(p.shader->ir, false, false, options,
- ctx->Const.NativeIntegers))
- ;
+ /* Conservative approach: Don't optimize here, the linker does it too. */
+ if (!ctx->Const.GLSLOptimizeConservatively) {
+ while (do_common_optimization(p.shader->ir, false, false, options,
+ ctx->Const.NativeIntegers))
+ ;
+ }
+
reparent_ir(p.shader->ir, p.shader->ir);
p.shader->CompileStatus = true;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c7535a37761..2693a8068c0 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3643,6 +3643,13 @@ struct gl_constants
bool GLSLFrontFacingIsSysVal;
/**
+ * Run the minimum amount of GLSL optimizations to be able to link
+ * shaders optimally (eliminate dead varyings and uniforms) and just do
+ * all the necessary lowering.
+ */
+ bool GLSLOptimizeConservatively;
+
+ /**
* Always use the GetTransformFeedbackVertexCount() driver hook, rather
* than passing the transform feedback object to the drawing function.
*/