From 63556fa9949f543a8134b6b5ff3d216acb71dd9f Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 23 Mar 2007 14:47:46 -0600 Subject: Add the ability to generate programs that doesn't use condition codes. ctx->Shader.EmitCondCodes determines if we use condition codes. If not, IF statement uses first operand's X component as the condition. Added OPCODE_BRK0, OPCODE_BRK1, OPCODE_CONT0, OPCODE_CONT1 to handle the common cases of conditional break/continue. --- src/mesa/shader/prog_print.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/mesa/shader/prog_print.c') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index d290ce0a2a5..39d2a07812e 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -572,10 +572,20 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, print_comment(inst); break; case OPCODE_IF: - _mesa_printf("IF (%s%s); # (if false, goto %d)", - condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE), - inst->BranchTarget); + if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { + /* Use ordinary register */ + _mesa_printf("IF "); + print_src_reg(&inst->SrcReg[0], mode, prog); + _mesa_printf("; "); + } + else { + /* Use cond codes */ + _mesa_printf("IF (%s%s);", + condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, + 0, GL_FALSE)); + } + _mesa_printf(" # (if false, goto %d)", inst->BranchTarget); print_comment(inst); return indent + 3; case OPCODE_ELSE: @@ -604,6 +614,18 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, inst->BranchTarget); print_comment(inst); break; + + case OPCODE_BRK0: + case OPCODE_BRK1: + case OPCODE_CONT0: + case OPCODE_CONT1: + _mesa_printf("%s ", _mesa_opcode_string(inst->Opcode)); + print_src_reg(&inst->SrcReg[0], mode, prog); + _mesa_printf("; "); + _mesa_printf(" # (goto %d)", inst->BranchTarget); + print_comment(inst); + break; + case OPCODE_BGNSUB: _mesa_printf("SUB"); print_comment(inst); -- cgit v1.2.3