Commit 4eae6dfa by Jamie Madill

Move native display check to the DisplayImpl.

This fixes another Linux compile error in the EGL layer. BUG=angle:773 Change-Id: Iba643a72fb7b0d5994fe69e46184256e07aa3aad Reviewed-on: https://chromium-review.googlesource.com/232945Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 0ecf9af6
......@@ -135,6 +135,15 @@ Display *Display::getDisplay(EGLNativeDisplayType displayId, const AttributeMap
else
{
display = new Display(displayId);
// Validate the native display
if (!display->isValidNativeDisplay(displayId))
{
// Still returns success
SafeDelete(display);
return NULL;
}
displays->insert(std::make_pair(displayId, display));
}
......@@ -678,6 +687,27 @@ bool Display::isValidNativeWindow(EGLNativeWindowType window) const
return mImplementation->isValidNativeWindow(window);
}
bool Display::isValidNativeDisplay(EGLNativeDisplayType display) const
{
// TODO(jmadill): handle this properly
if (display == EGL_DEFAULT_DISPLAY)
{
return true;
}
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_STORE)
if (display == EGL_SOFTWARE_DISPLAY_ANGLE ||
display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
{
return true;
}
return (WindowFromDC(display) != NULL);
#else
return true;
#endif
}
bool Display::supportsPlatformD3D()
{
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
......
......@@ -64,6 +64,7 @@ class Display final
bool isValidSurface(egl::Surface *surface);
bool hasExistingWindowSurface(EGLNativeWindowType window);
bool isValidNativeWindow(EGLNativeWindowType window) const;
bool isValidNativeDisplay(EGLNativeDisplayType display) const;
rx::Renderer *getRenderer() { return mRenderer; };
......
......@@ -118,17 +118,6 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
return EGL_NO_DISPLAY;
}
EGLNativeDisplayType displayId = static_cast<EGLNativeDisplayType>(native_display);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
// Validate the display device context
if (WindowFromDC(displayId) == NULL)
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
#endif
EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
bool majorVersionSpecified = false;
bool minorVersionSpecified = false;
......@@ -225,6 +214,8 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
}
recordError(egl::Error(EGL_SUCCESS));
EGLNativeDisplayType displayId = static_cast<EGLNativeDisplayType>(native_display);
return egl::Display::getDisplay(displayId, egl::AttributeMap(attrib_list));
}
......
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