Combine dx_Depth and dx_FrontCCW into dx_DepthFront.

TRAC #22245
Signed-off-by: Daniel Koch
Signed-off-by: Geoff Lang
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1582 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index b500083..017e8b0 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1701,8 +1701,8 @@
 }
 
 // Applies the render target surface, depth stencil surface, viewport rectangle and
-// scissor rectangle to the Direct3D 9 device
-bool Context::applyRenderTarget(bool ignoreViewport)
+// scissor rectangle to the renderer
+bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
 {
     Framebuffer *framebufferObject = getDrawFramebuffer();
 
@@ -1714,8 +1714,8 @@
     mRenderer->applyRenderTarget(framebufferObject);
 
     ProgramBinary *programBinary = mState.currentProgram ? getCurrentProgramBinary() : NULL;
-    if (!mRenderer->setViewport(mState.viewport, mState.zNear, mState.zFar, ignoreViewport,
-                                programBinary, mDxUniformsDirty))
+    if (!mRenderer->setViewport(mState.viewport, mState.zNear, mState.zFar, drawMode, mState.rasterizer.frontFace,
+                                ignoreViewport, programBinary, mDxUniformsDirty))
     {
         return false;
     }
@@ -1729,14 +1729,6 @@
 // Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
 void Context::applyState(GLenum drawMode)
 {
-    ProgramBinary *programBinary = getCurrentProgramBinary();
-
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-
-    GLint frontCCW = programBinary->getDxFrontCCWLocation();
-    GLfloat ccw = !IsTriangleMode(drawMode) ? 0.0f : (mState.rasterizer.frontFace == GL_CCW ? 1.0f : -1.0f);
-    programBinary->setUniform1fv(frontCCW, 1, &ccw);
-
     mRenderer->setRasterizerState(mState.rasterizer);
 
     unsigned int mask = 0;
@@ -1744,6 +1736,7 @@
     {
         if (mState.sampleCoverageValue != 0)
         {
+            Framebuffer *framebufferObject = getDrawFramebuffer();
             float threshold = 0.5f;
 
             for (int i = 0; i < framebufferObject->getSamples(); ++i)
@@ -1946,7 +1939,7 @@
         return error(GL_INVALID_VALUE);
     }
 
-    if (!applyRenderTarget(true))   // Clips the clear to the scissor rectangle but not the viewport
+    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
     {
         return;
     }
@@ -1977,7 +1970,7 @@
         return;
     }
 
-    if (!applyRenderTarget(false))
+    if (!applyRenderTarget(mode, false))
     {
         return;
     }
@@ -2023,7 +2016,7 @@
         return;
     }
 
-    if (!applyRenderTarget(false))
+    if (!applyRenderTarget(mode, false))
     {
         return;
     }