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/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;
}