From: Samuel Pitoiset Date: Mon, 24 Apr 2017 22:31:47 +0000 (+0200) Subject: st/glsl_to_tgsi: disable the merge registers pass conditionally X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=066a5729552925fc53e345b9e86a8699ba7ac451;p=mesa.git st/glsl_to_tgsi: disable the merge registers pass conditionally The main goal of this pass to merge temporary registers in order to reduce the total number of registers and also to produce optimal TGSI code. In fact, compilers seem to be confused when temporary variables are already merged, maybe because it's done too early in the process. Skipping the pass, reduce both the register pressure and the code size, at least for Nouveau and RadeonSI because they have a real backend compiler. Found by luck while fixing an issue in the TGSI dead code elimination pass which affects tex instructions with bindless samplers. Signed-off-by: Samuel Pitoiset Reviewed-by: Nicolai Hähnle Reviewed-by: Marek Olšák --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index de7fe7837a4..8ca90f6c43d 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6639,6 +6639,7 @@ get_mesa_program_tgsi(struct gl_context *ctx, &ctx->Const.ShaderCompilerOptions[shader->Stage]; struct pipe_screen *pscreen = ctx->st->pipe->screen; enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(shader->Stage); + unsigned skip_merge_registers; validate_ir_tree(shader->ir); @@ -6660,6 +6661,9 @@ get_mesa_program_tgsi(struct gl_context *ctx, PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED); v->has_tex_txf_lz = pscreen->get_param(pscreen, PIPE_CAP_TGSI_TEX_TXF_LZ); + skip_merge_registers = + pscreen->get_shader_param(pscreen, ptarget, + PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS); _mesa_generate_parameters_list_for_uniforms(shader_program, shader, prog->Parameters); @@ -6712,7 +6716,8 @@ get_mesa_program_tgsi(struct gl_context *ctx, while (v->eliminate_dead_code()); v->merge_two_dsts(); - v->merge_registers(); + if (!skip_merge_registers) + v->merge_registers(); v->renumber_registers(); /* Write the END instruction. */