Save render state across glFinish.

TRAC #12164

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

Author:    Andrew Lewycky

git-svn-id: https://angleproject.googlecode.com/svn/trunk@270 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index bd5ed5b..6789c7f 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2512,6 +2512,9 @@
 
     if (occlusionQuery)
     {
+        IDirect3DStateBlock9 *savedState = NULL;
+        device->CreateStateBlock(D3DSBT_ALL, &savedState);
+
         occlusionQuery->Issue(D3DISSUE_BEGIN);
 
         // Render something outside the render target
@@ -2531,6 +2534,12 @@
         }
 
         occlusionQuery->Release();
+
+        if (savedState)
+        {
+            savedState->Apply();
+            savedState->Release();
+        }
     }
 }