Commit a433388d by Corentin Wallez

Implement eglWait*

This mostly does nothing except on X11 where it calls the equivalent glXWait*. eglWait* are needed because they are used by Chromium and were triggering an UNREACHABLE(). BUG=angleproject:1281 Change-Id: Iff9c127b16841bc27728304a5ba2caff49ff11b5 Reviewed-on: https://chromium-review.googlesource.com/322360 Tryjob-Request: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 10277159
......@@ -796,6 +796,16 @@ void Display::notifyDeviceLost()
}
}
Error Display::waitClient() const
{
return mImplementation->waitClient();
}
Error Display::waitNative(EGLint engine) const
{
return mImplementation->waitNative(engine);
}
const Caps &Display::getCaps() const
{
return mCaps;
......
......@@ -91,6 +91,9 @@ class Display final : angle::NonCopyable
bool testDeviceLost();
void notifyDeviceLost();
Error waitClient() const;
Error waitNative(EGLint engine) const;
const Caps &getCaps() const;
const DisplayExtensions &getExtensions() const;
......
......@@ -82,6 +82,9 @@ class DisplayImpl : angle::NonCopyable
virtual egl::Error getDevice(DeviceImpl **device) = 0;
virtual egl::Error waitClient() const = 0;
virtual egl::Error waitNative(EGLint engine) const = 0;
const egl::Caps &getCaps() const;
typedef std::set<egl::Surface*> SurfaceSet;
......
......@@ -340,4 +340,16 @@ void DisplayD3D::generateCaps(egl::Caps *outCaps) const
outCaps->textureNPOT = mRenderer->getRendererExtensions().textureNPOT;
}
egl::Error DisplayD3D::waitClient() const
{
// Unimplemented as it is a noop on D3D
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayD3D::waitNative(EGLint engine) const
{
// Unimplemented as it is a noop on D3D
return egl::Error(EGL_SUCCESS);
}
}
......@@ -59,6 +59,9 @@ class DisplayD3D : public DisplayImpl
std::string getVendorString() const override;
egl::Error waitClient() const override;
egl::Error waitNative(EGLint engine) const override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;
......
......@@ -50,6 +50,9 @@ class DisplayCGL : public DisplayGL
std::string getVendorString() const override;
egl::Error waitClient() const override;
egl::Error waitNative(EGLint engine) const override;
private:
const FunctionsGL *getFunctionsGL() const override;
......
......@@ -256,4 +256,15 @@ void DisplayCGL::generateCaps(egl::Caps *outCaps) const
outCaps->textureNPOT = true;
}
egl::Error DisplayCGL::waitClient() const
{
// TODO(cwallez) UNIMPLEMENTED()
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayCGL::waitNative(EGLint engine) const
{
// TODO(cwallez) UNIMPLEMENTED()
return egl::Error(EGL_SUCCESS);
}
}
......@@ -639,6 +639,18 @@ std::string DisplayGLX::getVendorString() const
return "";
}
egl::Error DisplayGLX::waitClient() const
{
mGLX.waitGL();
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayGLX::waitNative(EGLint engine) const
{
mGLX.waitX();
return egl::Error(EGL_SUCCESS);
}
void DisplayGLX::syncXCommands() const
{
if (mUsesNewXDisplay)
......
......@@ -67,6 +67,9 @@ class DisplayGLX : public DisplayGL
std::string getVendorString() const override;
egl::Error waitClient() const override;
egl::Error waitNative(EGLint engine) const override;
// Synchronizes with the X server, if the display has been opened by ANGLE.
// Calling this is required at the end of every functions that does buffered
// X calls (not for glX calls) otherwise there might be race conditions
......
......@@ -475,4 +475,15 @@ void DisplayWGL::generateCaps(egl::Caps *outCaps) const
outCaps->textureNPOT = true;
}
egl::Error DisplayWGL::waitClient() const
{
// Unimplemented as this is not needed for WGL
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayWGL::waitNative(EGLint engine) const
{
// Unimplemented as this is not needed for WGL
return egl::Error(EGL_SUCCESS);
}
}
......@@ -52,6 +52,9 @@ class DisplayWGL : public DisplayGL
std::string getVendorString() const override;
egl::Error waitClient() const override;
egl::Error waitNative(EGLint engine) const override;
private:
const FunctionsGL *getFunctionsGL() const override;
......
......@@ -745,20 +745,56 @@ EGLBoolean EGLAPIENTRY WaitGL(void)
{
EVENT("()");
UNIMPLEMENTED(); // FIXME
Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
// eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement
// OpenGL ES we can do the call directly.
error = display->waitClient();
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
SetGlobalError(Error(EGL_SUCCESS));
return 0;
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY WaitNative(EGLint engine)
{
EVENT("(EGLint engine = %d)", engine);
UNIMPLEMENTED(); // FIXME
Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
if (engine != EGL_CORE_NATIVE_ENGINE)
{
SetGlobalError(
Error(EGL_BAD_PARAMETER, "the 'engine' parameter has an unrecognized value"));
}
error = display->waitNative(engine);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
SetGlobalError(Error(EGL_SUCCESS));
return 0;
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
......@@ -1063,10 +1099,24 @@ EGLBoolean EGLAPIENTRY WaitClient(void)
{
EVENT("()");
UNIMPLEMENTED(); // FIXME
Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
error = display->waitClient();
if (error.isError())
{
SetGlobalError(error);
return EGL_FALSE;
}
SetGlobalError(Error(EGL_SUCCESS));
return 0;
return EGL_TRUE;
}
// EGL 1.4
......
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