Commit 1d8ae673 by Geoff Lang

Add a makeCurrent method to Display.

BUG=angle:658 Change-Id: If1830fb164d31e2ee8092414d012e127ec344d69 Reviewed-on: https://chromium-review.googlesource.com/242033Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b3dced29
......@@ -163,6 +163,8 @@ Error Display::initialize()
void Display::terminate()
{
makeCurrent(nullptr, nullptr, nullptr);
while (!mContextSet.empty())
{
destroyContext(*mContextSet.begin());
......@@ -468,6 +470,22 @@ Error Display::createContext(const Config *configuration, EGLContext shareContex
return Error(EGL_SUCCESS);
}
Error Display::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
Error error = mImplementation->makeCurrent(drawSurface, readSurface, context);
if (error.isError())
{
return error;
}
if (context && drawSurface)
{
context->makeCurrent(drawSurface);
}
return egl::Error(EGL_SUCCESS);
}
Error Display::restoreLostDevice()
{
for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
......
......@@ -53,6 +53,8 @@ class Display final
Error createOffscreenSurface(const Config *configuration, EGLClientBuffer shareHandle, const EGLint *attribList, EGLSurface *outSurface);
Error createContext(const Config *configuration, EGLContext shareContext, const egl::AttributeMap &attribs, EGLContext *outContext);
Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context);
void destroySurface(egl::Surface *surface);
void destroyContext(gl::Context *context);
......
......@@ -53,6 +53,8 @@ class DisplayImpl
virtual egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &attribs,
gl::Context **outContext) = 0;
virtual egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) = 0;
virtual egl::ConfigSet generateConfigs() const = 0;
virtual bool isDeviceLost() const = 0;
......
......@@ -151,6 +151,11 @@ egl::Error DisplayD3D::createContext(const egl::Config *config, const gl::Contex
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayD3D::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
return egl::Error(EGL_SUCCESS);
}
egl::Error DisplayD3D::initialize(egl::Display *display, EGLNativeDisplayType nativeDisplay, const egl::AttributeMap &attribMap)
{
ASSERT(mRenderer == nullptr);
......
......@@ -33,6 +33,8 @@ class DisplayD3D : public DisplayImpl
egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &attribs,
gl::Context **outContext) override;
egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
egl::ConfigSet generateConfigs() const override;
bool isDeviceLost() const override;
......
......@@ -721,7 +721,7 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
if (context != nullptr && display != nullptr && drawSurface != nullptr)
{
context->makeCurrent(drawSurface);
display->makeCurrent(drawSurface, readSurface, context);
}
SetGlobalError(Error(EGL_SUCCESS));
......
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