r5xx: Consolidate FP tex insts.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 24 May 2008 18:30:57 +0000 (11:30 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 24 May 2008 18:30:57 +0000 (11:30 -0700)
They're all the same, really.

src/mesa/drivers/dri/r300/r500_fragprog.c

index 5dc674c577944de83ab797421af94acf4db28a17..482f9d55e77844d46238e47592501c5736063ea7 100644 (file)
@@ -237,7 +237,7 @@ static GLuint make_dest(struct r500_fragment_program *fp, struct prog_dst_regist
 }
 
 static void emit_tex(struct r500_fragment_program *fp,
-                    struct prog_instruction *fpi, int opcode, int dest, int counter)
+                    struct prog_instruction *fpi, int dest, int counter)
 {
        int hwsrc, hwdest;
        GLuint mask;
@@ -260,7 +260,7 @@ static void emit_tex(struct r500_fragment_program *fp,
        if (fpi->TexSrcTarget == TEXTURE_RECT_INDEX)
                fp->inst[counter].inst1 |= R500_TEX_UNSCALED;
 
-       switch (opcode) {
+       switch (fpi->Opcode) {
        case OPCODE_KIL:
                fp->inst[counter].inst1 |= R500_TEX_INST_TEXKILL;
                break;
@@ -274,7 +274,7 @@ static void emit_tex(struct r500_fragment_program *fp,
                fp->inst[counter].inst1 |= R500_TEX_INST_PROJ;
                break;
        default:
-               ERROR("emit_tex can't handle opcode %x\n", opcode);
+               ERROR("emit_tex can't handle opcode %x\n", fpi->Opcode);
        }
 
        fp->inst[counter].inst2 = R500_TEX_SRC_ADDR(hwsrc)
@@ -579,9 +579,6 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
                                fp->inst[counter].inst5 = R500_ALU_RGBA_OP_FRC
                                        | R500_ALU_RGBA_ADDRD(dest);
                                break;
-                       case OPCODE_KIL:
-                               emit_tex(fp, fpi, OPCODE_KIL, dest, counter);
-                               break;
                        case OPCODE_LG2:
                                src[0] = make_src(fp, fpi->SrcReg[0]);
                                emit_alu(fp, counter, fpi);
@@ -1017,18 +1014,11 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
                                emit_alu(fp, counter, fpi);
                                emit_mov(fp, counter, fpi->SrcReg[0], dest);
                                break;
+                       case OPCODE_KIL:
                        case OPCODE_TEX:
-                               emit_tex(fp, fpi, OPCODE_TEX, dest, counter);
-                                       if (fpi->DstReg.File == PROGRAM_OUTPUT)
-                                               counter++;
-                               break;
                        case OPCODE_TXB:
-                               emit_tex(fp, fpi, OPCODE_TXB, dest, counter);
-                                       if (fpi->DstReg.File == PROGRAM_OUTPUT)
-                                               counter++;
-                               break;
                        case OPCODE_TXP:
-                               emit_tex(fp, fpi, OPCODE_TXP, dest, counter);
+                               emit_tex(fp, fpi, dest, counter);
                                        if (fpi->DstReg.File == PROGRAM_OUTPUT)
                                                counter++;
                                break;