Ensure the device states are reinitialized after a device Reset

Trac #19246
Issue=262

After a device lost the "mSceneStarted" variable was getting out
of sync and thus we were never restarting the scene before drawing.
It's probably best to ensure that any default states we need are
also set after a reset.

Signed-off-by: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@909 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index 540304a..4d0eb38 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 0
 #define BUILD_VERSION 0
-#define BUILD_REVISION 908
+#define BUILD_REVISION 909
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index 4f1e7c2..534431d 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -447,13 +447,21 @@
         ASSERT(SUCCEEDED(result));
     }
 
+    initializeDevice();
+
+    return true;
+}
+
+// do any one-time device initialization
+// NOTE: this is also needed after a device lost/reset
+// to reset the scene status and ensure the default states are reset.
+void Display::initializeDevice()
+{
     // Permanent non-default states
     mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
     mDevice->SetRenderState(D3DRS_LASTPIXEL, FALSE);
 
     mSceneStarted = false;
-
-    return true;
 }
 
 bool Display::resetDevice()
@@ -497,6 +505,9 @@
         return error(EGL_BAD_ALLOC, false);
     }
 
+    // reset device defaults
+    initializeDevice();
+
     return true;
 }
 
diff --git a/src/libEGL/Display.h b/src/libEGL/Display.h
index 67e3d7d..d054ee9 100644
--- a/src/libEGL/Display.h
+++ b/src/libEGL/Display.h
@@ -122,6 +122,7 @@
     bool mDeviceLost;
 
     bool createDevice();
+    void initializeDevice();
     bool resetDevice();
 
     void initExtensionString();