Reset DepthStencilSurface after Context::markAllStateDirty() has been called.

Landing on Vangelis' behalf.

Original review: http://codereview.appspot.com/2184041/


git-svn-id: http://angleproject.googlecode.com/svn/trunk@419 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index b004a4a..353d4cd 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -314,6 +314,8 @@
 {
     mAppliedRenderTargetSerial = 0;
     mAppliedDepthbufferSerial = 0;
+    mAppliedStencilbufferSerial = 0;
+    mDepthStencilDirty = true;
     mAppliedProgram = 0;
 
     mClearStateDirty = true;
@@ -1605,11 +1607,13 @@
     }
 
     if (depthbufferSerial != mAppliedDepthbufferSerial ||
-        stencilbufferSerial != mAppliedStencilbufferSerial)
+        stencilbufferSerial != mAppliedStencilbufferSerial ||
+        mDepthStencilDirty)
     {
         device->SetDepthStencilSurface(depthStencil);
         mAppliedDepthbufferSerial = depthbufferSerial;
         mAppliedStencilbufferSerial = stencilbufferSerial;
+        mDepthStencilDirty = false;
     }
 
     D3DVIEWPORT9 viewport;
diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h
index e1a0c63..421b4ae 100644
--- a/src/libGLESv2/Context.h
+++ b/src/libGLESv2/Context.h
@@ -454,6 +454,7 @@
     unsigned int mAppliedRenderTargetSerial;
     unsigned int mAppliedDepthbufferSerial;
     unsigned int mAppliedStencilbufferSerial;
+    bool mDepthStencilDirty;
 
     bool mSupportsShaderModel3;
     std::map<D3DFORMAT, bool *> mMultiSampleSupport;