Commit 5d94a2b1 by Jamie Madill

Move native window check to the DisplayImpl.

This hides the D3D-specific methods from the EGL side of things. BUG=angle:773 Change-Id: I5a1c2bbff865e02bc1a07b3295347469ef9792e3 Reviewed-on: https://chromium-review.googlesource.com/232943Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org>
parent a0c18434
...@@ -673,6 +673,11 @@ const char *Display::getExtensionString(egl::Display *display) ...@@ -673,6 +673,11 @@ const char *Display::getExtensionString(egl::Display *display)
} }
} }
bool Display::isValidNativeWindow(EGLNativeWindowType window) const
{
return mImplementation->isValidNativeWindow(window);
}
bool Display::supportsPlatformD3D() bool Display::supportsPlatformD3D()
{ {
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11) #if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
......
...@@ -63,6 +63,7 @@ class Display ...@@ -63,6 +63,7 @@ class Display
bool isValidContext(gl::Context *context); bool isValidContext(gl::Context *context);
bool isValidSurface(egl::Surface *surface); bool isValidSurface(egl::Surface *surface);
bool hasExistingWindowSurface(EGLNativeWindowType window); bool hasExistingWindowSurface(EGLNativeWindowType window);
bool isValidNativeWindow(EGLNativeWindowType window) const;
rx::Renderer *getRenderer() { return mRenderer; }; rx::Renderer *getRenderer() { return mRenderer; };
......
...@@ -39,6 +39,8 @@ class DisplayImpl ...@@ -39,6 +39,8 @@ class DisplayImpl
EGLenum textureFormat, EGLenum textureTarget) = 0; EGLenum textureFormat, EGLenum textureTarget) = 0;
virtual egl::Error restoreLostDevice() = 0; virtual egl::Error restoreLostDevice() = 0;
virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
typedef std::set<egl::Surface*> SurfaceSet; typedef std::set<egl::Surface*> SurfaceSet;
const SurfaceSet &getSurfaceSet() const { return mSurfaceSet; } const SurfaceSet &getSurfaceSet() const { return mSurfaceSet; }
SurfaceSet &getSurfaceSet() { return mSurfaceSet; } SurfaceSet &getSurfaceSet() { return mSurfaceSet; }
......
...@@ -65,4 +65,9 @@ egl::Error DisplayD3D::restoreLostDevice() ...@@ -65,4 +65,9 @@ egl::Error DisplayD3D::restoreLostDevice()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const
{
return (IsWindow(window) == TRUE);
}
} }
...@@ -27,6 +27,8 @@ class DisplayD3D : public DisplayImpl ...@@ -27,6 +27,8 @@ class DisplayD3D : public DisplayImpl
EGLenum textureFormat, EGLenum textureTarget) override; EGLenum textureFormat, EGLenum textureTarget) override;
egl::Error restoreLostDevice() override; egl::Error restoreLostDevice() override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(DisplayD3D); DISALLOW_COPY_AND_ASSIGN(DisplayD3D);
......
...@@ -70,7 +70,6 @@ class NativeWindow ...@@ -70,7 +70,6 @@ class NativeWindow
}; };
bool IsValidEGLNativeWindowType(EGLNativeWindowType window);
} }
#endif // LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW_H_ #endif // LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW_H_
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
namespace rx namespace rx
{ {
bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
{
return (IsWindow(window) == TRUE);
}
NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window) NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
{ {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "libANGLE/Display.h" #include "libANGLE/Display.h"
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/SwapChain.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/version.h" #include "common/version.h"
...@@ -410,7 +409,7 @@ EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EG ...@@ -410,7 +409,7 @@ EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EG
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
} }
if (!rx::IsValidEGLNativeWindowType(win)) if (!display->isValidNativeWindow(win))
{ {
recordError(egl::Error(EGL_BAD_NATIVE_WINDOW)); recordError(egl::Error(EGL_BAD_NATIVE_WINDOW));
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
......
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