Context: Bind current display/surface.
Looking at the EGL spec, it says for eglGetCurrentDisplay:
"The display for the current context in the calling thread, for the
current rendering API, is returned."
This implies that MakeCurrent binds a display to a Context. There's
also pretty clear language for the read/draw Surface as well, that
they can only be bound to one Context/thread at a time. Hence we
don't need to duplicate this storage in the egl::Thread structure,
merely storing a pointer to the current Context, which has access
to the read/draw Surface and current Display.
BUG=angleproject:1156
Change-Id: Ia3b99d50b3591012c43e851834c1af02ff62a33f
Reviewed-on: https://chromium-review.googlesource.com/538865
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index c51cf33..f924c4a 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -266,7 +266,8 @@
mContextLostForced(false),
mResetStrategy(GetResetStrategy(attribs)),
mRobustAccess(GetRobustAccess(attribs)),
- mCurrentSurface(nullptr),
+ mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)),
+ mCurrentDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)),
mSurfacelessFramebuffer(nullptr),
mWebGLContext(GetWebGLContext(attribs)),
mScratchBuffer(1000u)
@@ -460,6 +461,8 @@
void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{
+ mCurrentDisplay = display;
+
if (!mHasBeenCurrent)
{
initRendererString();