Use IR node's BranchNode field for IF/ELSE/ENDIF instructions.
This allows us to back-patch the IF/ELSE instruction's BranchTarget field
to point to the location of the ELSE/ENDIF instructions. No longer have to
search for ELSE/ENDIF in the interpreter. Also makes it trivial to translate
IF/ELSE instructions into conditional/unconditional BRA instructions.
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 208c998..aea11da 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -319,13 +319,14 @@
print_comment(inst);
break;
case OPCODE_IF:
- _mesa_printf("IF (%s%s)",
+ _mesa_printf("IF (%s%s) (if false, goto %d)",
condcode_string(inst->DstReg.CondMask),
- swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE));
+ swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE),
+ inst->BranchTarget);
print_comment(inst);
return indent + 3;
case OPCODE_ELSE:
- _mesa_printf("ELSE\n");
+ _mesa_printf("ELSE (goto %d)\n", inst->BranchTarget);
return indent + 3;
case OPCODE_ENDIF:
_mesa_printf("ENDIF\n");