Commit db7e1081 authored by Antonio Caggiano's avatar Antonio Caggiano
Browse files

dEQP: Enable CreateSurfacePlatformEXT tests

Add the corresponding capability to NativeWindow and implement
getPlatformExtension virtual method to return a native pointer that can
be used with eglCreatePlatformWindowSurfaceEXT().

Bug: angleproject:6961
Change-Id: Ieb1a1fd8b3cae4e6f199c269f3922cbd0307aa35
parent 65441f45
......@@ -91,6 +91,9 @@ EGLSurface CreatePlatformWindowSurfaceEXT(Thread *thread,
GetDisplayIfValid(display), EGL_NO_SURFACE);
Surface *surface = nullptr;
// In X11, eglCreatePlatformWindowSurfaceEXT expects the native_window argument to be a pointer
// to a Window while the EGLNativeWindowType for X11 is its actual value.
// https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_platform_x11.txt
void *actualNativeWindow = display->getImplementation()->isX11()
? *reinterpret_cast<void **>(native_window)
: native_window;
......
......@@ -83,7 +83,8 @@ constexpr eglu::NativeWindow::Capability kWindowCapabilities =
eglu::NativeWindow::CAPABILITY_GET_SCREEN_SIZE |
eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS |
eglu::NativeWindow::CAPABILITY_SET_SURFACE_SIZE |
eglu::NativeWindow::CAPABILITY_CHANGE_VISIBILITY);
eglu::NativeWindow::CAPABILITY_CHANGE_VISIBILITY |
eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM_EXTENSION);
class ANGLENativeDisplay : public eglu::NativeDisplay
{
......@@ -169,6 +170,7 @@ class NativeWindow : public eglu::NativeWindow
~NativeWindow() override;
eglw::EGLNativeWindowType getLegacyNative() override;
void *getPlatformExtension() override;
IVec2 getSurfaceSize() const override;
IVec2 getScreenSize() const override { return getSurfaceSize(); }
void processEvents() override;
......@@ -337,6 +339,11 @@ eglw::EGLNativeWindowType NativeWindow::getLegacyNative()
return reinterpret_cast<eglw::EGLNativeWindowType>(mWindow->getNativeWindow());
}
void *NativeWindow::getPlatformExtension()
{
return mWindow->getPlatformExtension();
}
IVec2 NativeWindow::getSurfaceSize() const
{
int width = mWindow->getWidth();
......
......@@ -389,6 +389,11 @@ bool OSWindow::takeScreenshot(uint8_t *pixelData)
return false;
}
void *OSWindow::getPlatformExtension()
{
return reinterpret_cast<void *>(getNativeWindow());
}
bool OSWindow::popEvent(Event *event)
{
if (mEvents.size() > 0 && event)
......
......@@ -46,7 +46,11 @@ class ANGLE_UTIL_EXPORT OSWindow
// multiple EGLSurfaces.
virtual void resetNativeWindow() = 0;
virtual EGLNativeWindowType getNativeWindow() const = 0;
virtual EGLNativeWindowType getNativeWindow() const = 0;
// Returns a native pointer that can be used for eglCreatePlatformWindowSurfaceEXT().
virtual void *getPlatformExtension();
virtual EGLNativeDisplayType getNativeDisplay() const = 0;
virtual void messageLoop() = 0;
......
......@@ -396,6 +396,12 @@ EGLNativeWindowType X11Window::getNativeWindow() const
return mWindow;
}
void *X11Window::getPlatformExtension()
{
// X11 native window for eglCreateSurfacePlatformEXT is Window*
return &mWindow;
}
EGLNativeDisplayType X11Window::getNativeDisplay() const
{
return reinterpret_cast<EGLNativeDisplayType>(mDisplay);
......
......@@ -29,6 +29,7 @@ class ANGLE_UTIL_EXPORT X11Window : public OSWindow
void resetNativeWindow() override;
EGLNativeWindowType getNativeWindow() const override;
void *getPlatformExtension() override;
EGLNativeDisplayType getNativeDisplay() const override;
void messageLoop() override;
......
Supports Markdown
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