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
parent a5798959
#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)
......
......@@ -447,13 +447,21 @@ bool Display::createDevice()
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 @@ bool Display::resetDevice()
return error(EGL_BAD_ALLOC, false);
}
// reset device defaults
initializeDevice();
return true;
}
......
......@@ -122,6 +122,7 @@ class Display
bool mDeviceLost;
bool createDevice();
void initializeDevice();
bool resetDevice();
void initExtensionString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment