diff options
author | Kenneth Graunke <[email protected]> | 2013-04-17 17:30:22 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-05-12 09:36:41 -0700 |
commit | b765740a66821c4e97816a938c94740717661ba3 (patch) | |
tree | edc9135329af865781199d48e12514a1aa74ab01 /src/mesa | |
parent | 6bb9acfb4eb3f6a2c61e03cbd5a6c6c464d2ae0c (diff) |
glsl: Pass struct shader_compiler_options into do_common_optimization.
do_common_optimization may need to make choices about whether to emit
certain kinds of instructions. gl_context::ShaderCompilerOptions
contains exactly that information, so it makes sense to pass it in.
Rather than passing the whole array, pass the structure for the stage
that's currently being worked on.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 3 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 5 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 7 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 3bbcccdd3b3..8dcab75a433 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -209,7 +209,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) 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); diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 01a4542d747..91c425be678 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -1336,7 +1336,10 @@ create_new_program(struct gl_context *ctx, struct state_key *key) 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); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 363efe7da65..258b864f559 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -3025,7 +3025,8 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) 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; @@ -3131,11 +3132,13 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) 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); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index dd8810d454c..d175be602f4 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5255,7 +5255,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) 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; |