From: Bryan Cain Date: Mon, 27 Jun 2011 22:25:50 +0000 (-0500) Subject: glsl_to_tgsi: fix mistake in new dead code elimination pass X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c8b6a286887628e5fc35306189a4c4a83c482ea;p=mesa.git glsl_to_tgsi: fix mistake in new dead code elimination pass The conditions of IF opcodes were not being counted as reads, which sometimes led to the condition register being wrong or undefined. --- diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index e38617ae9fe..f87c64f62c7 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3315,10 +3315,6 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void) memset(writes, 0, sizeof(*writes) * this->next_temp * 4); break; - case TGSI_OPCODE_IF: - ++level; - break; - case TGSI_OPCODE_ENDIF: --level; break; @@ -3341,6 +3337,10 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void) } break; + case TGSI_OPCODE_IF: + ++level; + /* fallthrough to default case to mark the condition as read */ + default: /* Continuing the block, clear any channels from the write array that * are read by this instruction.