r500: some trivial fixups to get tri working.
authorDave Airlie <airlied@redhat.com>
Thu, 15 May 2008 03:21:50 +0000 (13:21 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 15 May 2008 08:40:07 +0000 (18:40 +1000)
the counter was being used one instruction over the end

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

index 9c46cc795f8b4e692fbd526fdbdae83a9eb0c938..b6d600d40a9cc69e7528fd8fab58c15e852b4e08 100644 (file)
@@ -305,7 +305,7 @@ static void r300EmitClearState(GLcontext * ctx)
 
                R300_STATECHANGE(r300, rr);
                reg_start(R300_RS_INST_0, 0);
-               e32(R500_RS_INST_COL_CN_WRITE);
+               e32(R300_RS_INST_COL_CN_WRITE);
        } else {
          
                R300_STATECHANGE(r300, ri);
@@ -357,6 +357,10 @@ static void r300EmitClearState(GLcontext * ctx)
                reg_start(R300_US_ALU_ALPHA_ADDR_0, 0);
                e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
        } else {
+               R300_STATECHANGE(r300, fp);
+               reg_start(R500_US_PIXSIZE, 0);
+               e32(0x2);
+
                R300_STATECHANGE(r300, r500fp);
                r500fp_start_fragment(0, 6);
 
@@ -387,15 +391,15 @@ static void r300EmitClearState(GLcontext * ctx)
                    R500_ALU_RGB_G_SWIZ_A_G |
                    R500_ALU_RGB_B_SWIZ_A_B |
                    R500_ALU_RGB_SEL_B_SRC0 |
-                   R500_ALU_RGB_R_SWIZ_B_1 |
-                   R500_ALU_RGB_B_SWIZ_B_1 |
-                   R500_ALU_RGB_G_SWIZ_B_1);
+                   R500_ALU_RGB_R_SWIZ_B_R |
+                   R500_ALU_RGB_B_SWIZ_B_G |
+                   R500_ALU_RGB_G_SWIZ_B_B);
 
-               e32(R500_ALPHA_OP_MAD |
+               e32(R500_ALPHA_OP_CMP |
                    R500_ALPHA_SWIZ_A_A |
-                   R500_ALPHA_SWIZ_B_1);
+                   R500_ALPHA_SWIZ_B_A);
 
-               e32(R500_ALU_RGBA_OP_MAD |
+               e32(R500_ALU_RGBA_OP_CMP |
                    R500_ALU_RGBA_R_SWIZ_0 |
                    R500_ALU_RGBA_G_SWIZ_0 |
                    R500_ALU_RGBA_B_SWIZ_0 |
index f9ef582d0a54c46dac8b08709498edfcb04e648e..2ea77bcfade39ecd8a6b9f35f3a85039bb8b4c5e 100644 (file)
@@ -601,12 +601,11 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
        }
 
        /* Finish him! (If it's an ALU/OUT instruction...) */
-       if ((fp->inst[counter].inst0 & 0x3) ^ 0x2) {
-               fp->inst[counter].inst0 |= R500_INST_TYPE_OUT
+       if ((fp->inst[counter-1].inst0 & 0x3) <= 1) {
+               fp->inst[counter-1].inst0 |= R500_INST_TYPE_OUT
                        | R500_INST_TEX_SEM_WAIT | R500_INST_LAST;
        } else {
                /* We still need to put an output inst, right? */
-               counter++;
                fp->inst[counter].inst0 = R500_INST_TYPE_OUT
                        | R500_INST_TEX_SEM_WAIT | R500_INST_LAST
                        | R500_INST_RGB_OMASK_R | R500_INST_RGB_OMASK_G
@@ -625,6 +624,7 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
                        | R500_ALU_RGBA_ADDRD(0)
                        | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO)
                        | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO);
+               counter++;
        }
 
        fp->cs->nrslots = counter;