* \param max_unroll_iterations Maximum number of loop iterations to be
* unrolled. Setting to 0 disables loop
* unrolling.
+ * \param options The driver's preferred shader options.
*/
bool
do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations)
+ unsigned max_unroll_iterations,
+ const struct gl_shader_compiler_options *options)
{
GLboolean progress = GL_FALSE;
bool do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations);
+ unsigned max_unroll_iterations,
+ const struct gl_shader_compiler_options *options);
bool do_algebraic(exec_list *instructions);
bool do_constant_folding(exec_list *instructions);
unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll))
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i]))
;
}
/* Optimization passes */
if (!state->error && !shader->ir->is_empty()) {
+ const struct gl_shader_compiler_options *opts =
+ &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
bool progress;
do {
- progress = do_common_optimization(shader->ir, false, false, 32);
+ progress = do_common_optimization(shader->ir, false, false, 32, opts);
} while (progress);
validate_ir_tree(shader->ir);
false /* loops */
) || progress;
- progress = do_common_optimization(shader->ir, true, true, 32)
+ progress = do_common_optimization(shader->ir, true, true, 32,
+ &ctx->ShaderCompilerOptions[stage])
|| progress;
} while (progress);
validate_ir_tree(p.shader->ir);
- while (do_common_optimization(p.shader->ir, false, false, 32))
+ const struct gl_shader_compiler_options *options =
+ &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
+
+ while (do_common_optimization(p.shader->ir, false, false, 32, options))
;
reparent_ir(p.shader->ir, p.shader->ir);
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations)
+ options->MaxUnrollIterations,
+ options)
|| progress;
progress = lower_quadop_vector(ir, true) || progress;
if (!state->error && !shader->ir->is_empty()) {
validate_ir_tree(shader->ir);
+ struct gl_shader_compiler_options *options =
+ &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
/* 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))
+ while (do_common_optimization(shader->ir, false, false, 32, options))
;
validate_ir_tree(shader->ir);
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations)
+ options->MaxUnrollIterations, options)
|| progress;
progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress;