summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-25 00:31:47 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-04-26 19:15:37 +0200
commit066a5729552925fc53e345b9e86a8699ba7ac451 (patch)
tree9278e8f896e7f8f82451e03875e7a43339e34735
parent3a927e0aa34d2d27583063732eadfddccd1ebdd2 (diff)
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 <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
1 files changed, 6 insertions, 1 deletions
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. */