diff options
author | Brian <[email protected]> | 2007-03-28 14:38:36 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-03-28 14:38:36 -0600 |
commit | 3b7f2f53a222b06ca14fff44b5e1143e1b41e390 (patch) | |
tree | fa14b33344efa1fe6a2242b716486c019e0865e1 /src/mesa/shader | |
parent | 8128f7143d9c3768df4cf669e97777e021db127a (diff) |
remove IR_BREAK_IF_FALSE
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 54 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_ir.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_ir.h | 1 |
3 files changed, 13 insertions, 46 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 310a9f12439..b5a2dfaafc4 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1207,7 +1207,6 @@ emit_loop(slang_emit_info *emitInfo, slang_ir_node *n) struct prog_instruction *inst = prog->Instructions + ir->InstLocation; assert(inst->BranchTarget < 0); if (ir->Opcode == IR_BREAK || - ir->Opcode == IR_BREAK_IF_FALSE || ir->Opcode == IR_BREAK_IF_TRUE) { assert(inst->Opcode == OPCODE_BRK || inst->Opcode == OPCODE_BRA); @@ -1269,14 +1268,12 @@ emit_cont_break(slang_emit_info *emitInfo, slang_ir_node *n) * Either OPCODE_CONT, OPCODE_BRK or OPCODE_BRA will be emitted. */ static struct prog_instruction * -emit_cont_break_if(slang_emit_info *emitInfo, slang_ir_node *n, - GLboolean breakTrue) +emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) { struct prog_instruction *inst; assert(n->Opcode == IR_CONT_IF_TRUE || - n->Opcode == IR_BREAK_IF_TRUE || - n->Opcode == IR_BREAK_IF_FALSE); + n->Opcode == IR_BREAK_IF_TRUE); /* evaluate condition expr, setting cond codes */ inst = emit(emitInfo, n->Children[0]); @@ -1289,11 +1286,11 @@ emit_cont_break_if(slang_emit_info *emitInfo, slang_ir_node *n, /* opcode selection */ if (emitInfo->EmitHighLevelInstructions) { + const gl_inst_opcode opcode + = (n->Opcode == IR_CONT_IF_TRUE) ? OPCODE_CONT : OPCODE_BRK; if (emitInfo->EmitCondCodes) { - gl_inst_opcode opcode - = (n->Opcode == IR_CONT_IF_TRUE) ? OPCODE_CONT : OPCODE_BRK; inst = new_instruction(emitInfo, opcode); - inst->DstReg.CondMask = breakTrue ? COND_NE : COND_EQ; + inst->DstReg.CondMask = COND_NE; return inst; } else { @@ -1302,35 +1299,12 @@ emit_cont_break_if(slang_emit_info *emitInfo, slang_ir_node *n, * ENDIF */ GLint ifInstLoc; - if (n->Opcode == IR_CONT_IF_TRUE || - n->Opcode == IR_BREAK_IF_TRUE) { - ifInstLoc = emitInfo->prog->NumInstructions; - inst = new_instruction(emitInfo, OPCODE_IF); - storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store); - } - else { - /* invert the expression */ - if (!alloc_temp_storage(emitInfo, n, 1)) - return NULL; - inst = new_instruction(emitInfo, OPCODE_SEQ); - storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store); - constant_to_src_reg(&inst->SrcReg[1], 0.0, emitInfo); - storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); - inst->Comment = _mesa_strdup("Invert true/false"); - - ifInstLoc = emitInfo->prog->NumInstructions; - inst = new_instruction(emitInfo, OPCODE_IF); - storage_to_src_reg(&inst->SrcReg[0], n->Store); - free_temp_storage(emitInfo->vt, n); - } + ifInstLoc = emitInfo->prog->NumInstructions; + inst = new_instruction(emitInfo, OPCODE_IF); + storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store); n->InstLocation = emitInfo->prog->NumInstructions; - if (n->Opcode == IR_BREAK_IF_TRUE || - n->Opcode == IR_BREAK_IF_FALSE) { - inst = new_instruction(emitInfo, OPCODE_BRK); - } - else { - inst = new_instruction(emitInfo, OPCODE_CONT); - } + + inst = new_instruction(emitInfo, opcode); inst = new_instruction(emitInfo, OPCODE_ENDIF); emitInfo->prog->Instructions[ifInstLoc].BranchTarget @@ -1341,7 +1315,7 @@ emit_cont_break_if(slang_emit_info *emitInfo, slang_ir_node *n, else { assert(emitInfo->EmitCondCodes); inst = new_instruction(emitInfo, OPCODE_BRA); - inst->DstReg.CondMask = breakTrue ? COND_NE : COND_EQ; + inst->DstReg.CondMask = COND_NE; return inst; } } @@ -1677,11 +1651,9 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) case IR_LOOP: return emit_loop(emitInfo, n); - case IR_BREAK_IF_FALSE: - return emit_cont_break_if(emitInfo, n, GL_FALSE); case IR_BREAK_IF_TRUE: case IR_CONT_IF_TRUE: - return emit_cont_break_if(emitInfo, n, GL_TRUE); + return emit_cont_break_if_true(emitInfo, n); case IR_BREAK: /* fall-through */ case IR_CONT: @@ -1790,7 +1762,7 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, emitInfo.NumSubroutines = 0; emitInfo.EmitHighLevelInstructions = ctx->Shader.EmitHighLevelInstructions; - emitInfo.EmitCondCodes = ctx->Shader.EmitCondCodes; + emitInfo.EmitCondCodes = 0*ctx->Shader.EmitCondCodes; emitInfo.EmitComments = ctx->Shader.EmitComments; emitInfo.EmitBeginEndSub = 0; /* XXX for compiler debug only */ diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index dd17b4a1e0b..0c2e65ab5e3 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -326,10 +326,6 @@ _slang_print_ir_tree(const slang_ir_node *n, int indent) case IR_BREAK: printf("BREAK\n"); break; - case IR_BREAK_IF_FALSE: - printf("BREAK_IF_FALSE\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; case IR_BREAK_IF_TRUE: printf("BREAK_IF_TRUE\n"); _slang_print_ir_tree(n->Children[0], indent+3); diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index a183ea62e2f..69db4b5451e 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -73,7 +73,6 @@ typedef enum IR_BREAK, /* break loop */ IR_BREAK_IF_TRUE, - IR_BREAK_IF_FALSE, IR_CONT_IF_TRUE, /* Children[0] = the condition expression */ |