Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
[mesa.git] / src / mesa / drivers / dri / r600 / r700_state.c
index d7420678ff0f7de0079e9b1a0716a4557208416c..16b05d5cd9a462a00325ab1e5a602565d126a76b 100644 (file)
@@ -705,6 +705,10 @@ static void r700UpdateCulling(GLcontext * ctx)
             CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */
             break;
     }
+
+    /* Winding is inverted when rendering to FBO */
+    if (ctx->DrawBuffer && ctx->DrawBuffer->Name)
+           r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit;
 }
 
 static void r700UpdateLineStipple(GLcontext * ctx)
@@ -1227,13 +1231,8 @@ static void r700UpdatePolygonMode(GLcontext * ctx)
                /* Handle GL_CW (clock wise and GL_CCW (counter clock wise)
                 * correctly by selecting the correct front and back face
                 */
-               if (ctx->Polygon.FrontFace == GL_CCW) {
-                       f = ctx->Polygon.FrontMode;
-                       b = ctx->Polygon.BackMode;
-               } else {
-                       f = ctx->Polygon.BackMode;
-                       b = ctx->Polygon.FrontMode;
-               }
+               f = ctx->Polygon.FrontMode;
+               b = ctx->Polygon.BackMode;
 
                /* Enable polygon mode */
                SETfield(r700->PA_SU_SC_MODE_CNTL.u32All, X_DUAL_MODE, POLY_MODE_shift, POLY_MODE_mask);