Fix gloss breakage when using hw tnl.
authorAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 11:57:45 +0000 (11:57 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Thu, 16 Jun 2005 11:57:45 +0000 (11:57 +0000)
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_vertexprog.c

index fd1b006..0e2652a 100644 (file)
@@ -1146,7 +1146,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
                                | interp_magic[i];
 
                if (InputsRead & (FRAG_BIT_TEX0<<i)) {
-                       assert(r300->state.texture.tc_count != 0);
+                       //assert(r300->state.texture.tc_count != 0);
                        r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0
                                        | R300_RS_ROUTE_ENABLE
                                        | i /* source INTERP */
index 8a10931..178ca76 100644 (file)
@@ -673,6 +673,25 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
                        goto next;
 
                case VP_OPCODE_SUB://ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
+#if 1
+                       hw_op=(src[0].File == PROGRAM_TEMPORARY &&
+                               src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
+                       
+                       o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
+                               t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
+                       o_inst->src1=t_src(vp, &src[0]);
+                       o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
+                                               SWIZZLE_ONE, SWIZZLE_ONE,
+                                               SWIZZLE_ONE, SWIZZLE_ONE,
+                                               t_src_class(src[0].File), VSF_FLAG_NONE);
+                       o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
+                                       t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
+                                       t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
+                                       t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
+                                       t_swizzle(GET_SWZ(src[1].Swizzle, 3)),
+                                       t_src_class(src[1].File),
+                                       (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
+#else
                        o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                                        t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
                        
@@ -685,6 +704,7 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
                                        t_src_class(src[1].File),
                                        (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
                        o_inst->src3=0;
+#endif
                        goto next;
                        
                case VP_OPCODE_ABS://MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W