Commit 2ebff7f2 by Peng Huang Committed by Commit Bot

Support switch surfaces for external context.

WebView may change surfaces due to resizing. So we need to support switching surfaces with the external context. Bug: angleproject:5509 Change-Id: Id91eed092a63b3740fd796e0a3cb819ae18baaa9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2639077Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
parent 0ae61c25
...@@ -354,25 +354,36 @@ egl::Error DisplayAndroid::makeCurrent(egl::Display *display, ...@@ -354,25 +354,36 @@ egl::Error DisplayAndroid::makeCurrent(egl::Display *display,
if (currentContext.isExternalContext || (context && context->isExternal())) if (currentContext.isExternalContext || (context && context->isExternal()))
{ {
ASSERT(currentContext.context == EGL_NO_CONTEXT);
ASSERT(currentContext.surface == EGL_NO_SURFACE); ASSERT(currentContext.surface == EGL_NO_SURFACE);
if (!currentContext.isExternalContext) if (!currentContext.isExternalContext)
{ {
// Switch to an ANGLE external context. // Switch to an ANGLE external context.
ASSERT(context); ASSERT(context);
ASSERT(currentContext.context == EGL_NO_CONTEXT);
currentContext.context = newContext;
currentContext.isExternalContext = true; currentContext.isExternalContext = true;
// We only support using external surface with external context. // We only support using external surface with external context.
ASSERT(GetImplAs<SurfaceEGL>(drawSurface)->isExternal()); ASSERT(GetImplAs<SurfaceEGL>(drawSurface)->isExternal());
ASSERT(GetImplAs<SurfaceEGL>(drawSurface)->getSurface() == EGL_NO_SURFACE);
}
else if (context)
{
// Switch surface but not context.
ASSERT(currentContext.context == newContext);
ASSERT(newSurface == EGL_NO_SURFACE);
ASSERT(newContext != EGL_NO_CONTEXT);
// We only support using external surface with external context.
ASSERT(GetImplAs<SurfaceEGL>(drawSurface)->isExternal());
ASSERT(GetImplAs<SurfaceEGL>(drawSurface)->getSurface() == EGL_NO_SURFACE);
} }
else else
{ {
// We don't support switching surfaces for external context.
ASSERT(!context);
// Release the ANGLE external context. // Release the ANGLE external context.
ASSERT(newSurface == EGL_NO_CONTEXT); ASSERT(newSurface == EGL_NO_SURFACE);
ASSERT(newContext == EGL_NO_SURFACE); ASSERT(newContext == EGL_NO_CONTEXT);
ASSERT(currentContext.context != EGL_NO_CONTEXT);
currentContext.context = EGL_NO_CONTEXT;
currentContext.isExternalContext = false; currentContext.isExternalContext = false;
} }
......
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