Fixed issues with state force flag initialization and applyRenderTarget placement.

TRAC #22041

Fixed the state force flags being incorrectly initialized in Renderer9's
destructor, they are now in the constructor.  Renderer::applyRenderTarget
is now correctly called fromt he begining of Context::applyRenderTarget
instead of the end.

Signed-off-by: Daniel Koch

Author:    Geoff Lang

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1425 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 7afce94..646baed 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1751,6 +1751,8 @@
         return error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
     }
 
+    mRenderer->applyRenderTarget(framebufferObject);
+
     // if there is no color attachment we must synthesize a NULL colorattachment
     // to keep the D3D runtime happy.  This should only be possible if depth texturing.
     Renderbuffer *renderbufferObject = NULL;
@@ -1904,8 +1906,6 @@
         mDxUniformsDirty = false;
     }
 
-    mRenderer->applyRenderTarget(framebufferObject);
-
     return true;
 }
 
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index d45cd8f..eed3a16 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -79,6 +79,11 @@
     mDeviceLost = false;
 
     mMaxSupportedSamples = 0;
+
+    mForceSetDepthStencilState = true;
+    mForceSetRasterState = true;
+    mForceSetBlendState = true;
+    mForceSetScissor = true;
 }
 
 Renderer9::~Renderer9()
@@ -133,11 +138,6 @@
         delete [] mMultiSampleSupport.begin()->second;
         mMultiSampleSupport.erase(mMultiSampleSupport.begin());
     }
-
-    mForceSetDepthStencilState = true;
-    mForceSetRasterState = true;
-    mForceSetBlendState = true;
-    mForceSetScissor = true;
 }
 
 EGLint Renderer9::initialize()