r300/compiler: Implement the CONT opcode.
This commit is contained in:
@@ -126,7 +126,7 @@ static unsigned translate_opcode(unsigned opcode)
|
||||
/* case TGSI_OPCODE_SAD: return RC_OPCODE_SAD; */
|
||||
/* case TGSI_OPCODE_TXF: return RC_OPCODE_TXF; */
|
||||
/* case TGSI_OPCODE_TXQ: return RC_OPCODE_TXQ; */
|
||||
/* case TGSI_OPCODE_CONT: return RC_OPCODE_CONT; */
|
||||
case TGSI_OPCODE_CONT: return RC_OPCODE_CONT;
|
||||
/* case TGSI_OPCODE_EMIT: return RC_OPCODE_EMIT; */
|
||||
/* case TGSI_OPCODE_ENDPRIM: return RC_OPCODE_ENDPRIM; */
|
||||
/* case TGSI_OPCODE_BGNLOOP2: return RC_OPCODE_BGNLOOP2; */
|
||||
|
||||
@@ -70,6 +70,10 @@ struct loop_info {
|
||||
int * Brks;
|
||||
int BrkCount;
|
||||
int BrkReserved;
|
||||
|
||||
int * Conts;
|
||||
int ContCount;
|
||||
int ContReserved;
|
||||
};
|
||||
|
||||
struct emit_state {
|
||||
@@ -413,15 +417,18 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst
|
||||
;
|
||||
break;
|
||||
|
||||
case RC_OPCODE_CONTINUE:
|
||||
case RC_OPCODE_CONT:
|
||||
loop = &s->Loops[s->CurrentLoopDepth - 1];
|
||||
s->Code->inst[newip].inst2 = R500_FC_OP_JUMP
|
||||
memory_pool_array_reserve(&s->C->Pool, int, loop->Conts,
|
||||
loop->ContCount, loop->ContReserved, 1);
|
||||
loop->Conts[loop->ContCount++] = newip;
|
||||
s->Code->inst[newip].inst2 = R500_FC_OP_CONTINUE
|
||||
| R500_FC_JUMP_FUNC(0xff)
|
||||
| R500_FC_B_OP1_DECR
|
||||
| R500_FC_B_POP_CNT(
|
||||
s->CurrentBranchDepth - loop->BranchDepth)
|
||||
| R500_FC_IGNORE_UNCOVERED
|
||||
;
|
||||
s->Code->inst[newip].inst3 = R500_FC_JUMP_ADDR(loop->BgnLoop);
|
||||
break;
|
||||
|
||||
case RC_OPCODE_ENDLOOP:
|
||||
@@ -449,6 +456,12 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst
|
||||
s->Code->inst[loop->Brks[loop->BrkCount]].inst3 =
|
||||
R500_FC_JUMP_ADDR(newip + 1);
|
||||
}
|
||||
|
||||
/* Set jump address for CONT instructions. */
|
||||
while(loop->ContCount--) {
|
||||
s->Code->inst[loop->Conts[loop->ContCount]].inst3 =
|
||||
R500_FC_JUMP_ADDR(newip);
|
||||
}
|
||||
s->CurrentLoopDepth--;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RC_OPCODE_CONTINUE:
|
||||
case RC_OPCODE_CONT:
|
||||
break;
|
||||
case RC_OPCODE_ENDIF:
|
||||
push_branch(&s);
|
||||
|
||||
@@ -386,8 +386,8 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = {
|
||||
.NumSrcRegs = 0,
|
||||
},
|
||||
{
|
||||
.Opcode = RC_OPCODE_CONTINUE,
|
||||
.Name = "CONTINUE",
|
||||
.Opcode = RC_OPCODE_CONT,
|
||||
.Name = "CONT",
|
||||
.IsFlowControl = 1,
|
||||
.NumSrcRegs = 0
|
||||
},
|
||||
|
||||
@@ -187,7 +187,7 @@ typedef enum {
|
||||
|
||||
RC_OPCODE_ENDLOOP,
|
||||
|
||||
RC_OPCODE_CONTINUE,
|
||||
RC_OPCODE_CONT,
|
||||
|
||||
/** special instruction, used in R300-R500 fragment program pair instructions
|
||||
* indicates that the result of the alpha operation shall be replicated
|
||||
|
||||
Reference in New Issue
Block a user