diff options
author | Marek Olšák <[email protected]> | 2013-01-31 19:44:57 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-06 14:51:31 +0100 |
commit | afd4178fecc5d027e499085d6a4279bf2f890789 (patch) | |
tree | f92cb405c4efd7ee4c53e5a957868db24bfb7f45 /src | |
parent | 7325f1faaade3637680898319e21512c2a6cca5e (diff) |
st/mesa: do most of GLSL lowering outside of the optimization do-while loop
based on the intel driver
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index e46a4a8323f..3e9ff805a4b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5155,21 +5155,37 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) const struct gl_shader_compiler_options *options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)]; - do { - unsigned what_to_lower = MOD_TO_FRACT | DIV_TO_MUL_RCP | - EXP_TO_EXP2 | LOG_TO_LOG2; - if (options->EmitNoPow) - what_to_lower |= POW_TO_EXP2; - if (!ctx->Const.NativeIntegers) - what_to_lower |= INT_DIV_TO_MUL_RCP; - - progress = false; + /* If there are forms of indirect addressing that the driver + * cannot handle, perform the lowering pass. + */ + if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput || + options->EmitNoIndirectTemp || options->EmitNoIndirectUniform) { + lower_variable_index_to_cond_assign(ir, + options->EmitNoIndirectInput, + options->EmitNoIndirectOutput, + options->EmitNoIndirectTemp, + options->EmitNoIndirectUniform); + } - /* Lowering */ - do_mat_op_to_vec(ir); - lower_instructions(ir, what_to_lower); + do_mat_op_to_vec(ir); + lower_instructions(ir, + MOD_TO_FRACT | + DIV_TO_MUL_RCP | + EXP_TO_EXP2 | + LOG_TO_LOG2 | + (options->EmitNoPow ? POW_TO_EXP2 : 0) | + (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0)); + + lower_ubo_reference(prog->_LinkedShaders[i], ir); + do_vec_index_to_cond_assign(ir); + lower_quadop_vector(ir, false); + lower_noise(ir); + if (options->MaxIfDepth == 0) { + lower_discard(ir); + } - lower_ubo_reference(prog->_LinkedShaders[i], ir); + do { + progress = false; progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; @@ -5177,31 +5193,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) options->MaxUnrollIterations) || progress; - progress = lower_quadop_vector(ir, false) || progress; - - if (options->MaxIfDepth == 0) - progress = lower_discard(ir) || progress; - progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress; - if (options->EmitNoNoise) - progress = lower_noise(ir) || progress; - - /* If there are forms of indirect addressing that the driver - * cannot handle, perform the lowering pass. - */ - if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput - || options->EmitNoIndirectTemp || options->EmitNoIndirectUniform) - progress = - lower_variable_index_to_cond_assign(ir, - options->EmitNoIndirectInput, - options->EmitNoIndirectOutput, - options->EmitNoIndirectTemp, - options->EmitNoIndirectUniform) - || progress; - - progress = do_vec_index_to_cond_assign(ir) || progress; - } while (progress); validate_ir_tree(ir); |