summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_print.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-23 14:47:46 -0600
committerBrian <[email protected]>2007-03-23 14:47:46 -0600
commit63556fa9949f543a8134b6b5ff3d216acb71dd9f (patch)
tree347e41773e171e24ef3a6a476567e2b706bd341d /src/mesa/shader/prog_print.c
parentbf020d8d7f719dfea7ea3c65bd2833df6439b59e (diff)
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.
Diffstat (limited to 'src/mesa/shader/prog_print.c')
-rw-r--r--src/mesa/shader/prog_print.c30
1 files changed, 26 insertions, 4 deletions
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);