Commit d64134c3 by apatrick@chromium.org

Avoid crash in createDevice() if it is called on a Display that did not…

Avoid crash in createDevice() if it is called on a Display that did not initialize (e.g. Direct3DCreate9 returned NULL). Fixed compiler warning. Landed on behalf of baustin: https://codereview.appspot.com/7794046/. Review URL: https://codereview.appspot.com/7494048 git-svn-id: https://angleproject.googlecode.com/svn/trunk@2000 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 60ea6836
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 1999 #define BUILD_REVISION 2000
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -477,6 +477,10 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value) ...@@ -477,6 +477,10 @@ bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
bool Display::createDevice() bool Display::createDevice()
{ {
if (!isInitialized())
{
return error(EGL_NOT_INITIALIZED, false);
}
D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters(); D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES; DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
...@@ -1163,7 +1167,7 @@ float Display::getTextureFilterAnisotropySupport() const ...@@ -1163,7 +1167,7 @@ float Display::getTextureFilterAnisotropySupport() const
// Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec // Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec
if ((mDeviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) && (mDeviceCaps.MaxAnisotropy >= 2)) if ((mDeviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) && (mDeviceCaps.MaxAnisotropy >= 2))
{ {
return mDeviceCaps.MaxAnisotropy; return static_cast<float>(mDeviceCaps.MaxAnisotropy);
} }
return 1.0f; return 1.0f;
} }
......
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