Capture/Replay: Multi-Context Support

Add support for capturing and replaying multiple contexts.

1.) Create and initialize the Contexts in the share group during
SetupReplay().
2.) Track the Context the command stream is for, and if the Context ID
changes, inject an eglMakeCurrent() call to switch to the new Context.
3.) Intercept eglCreateContext() and eglMakeCurrent() to route to either
EGLWindow or WGLWindow, depending on the current platform.

Specifically, this enables capturing and replaying Asphalt 9.

Bug: angleproject:5878
Change-Id: I5bc9b7ece5388ce405ba3f9e9dc3967e78662000
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2830145
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
This commit is contained in:
Tim Van Patten
2021-04-16 12:28:50 -06:00
committed by Angle LUCI CQ
parent 4c56534f31
commit 58bb11ca62
11 changed files with 374 additions and 70 deletions

View File

@@ -486,7 +486,18 @@ bool EGLWindow::initializeSurface(OSWindow *osWindow,
return true;
}
EGLContext EGLWindow::createContext(EGLContext share) const
GLWindowContext EGLWindow::getCurrentContextGeneric()
{
return reinterpret_cast<GLWindowContext>(mContext);
}
GLWindowContext EGLWindow::createContextGeneric(GLWindowContext share)
{
EGLContext shareContext = reinterpret_cast<EGLContext>(share);
return reinterpret_cast<GLWindowContext>(createContext(shareContext));
}
EGLContext EGLWindow::createContext(EGLContext share)
{
const char *displayExtensions = eglQueryString(mDisplay, EGL_EXTENSIONS);
@@ -769,9 +780,20 @@ EGLBoolean EGLWindow::FindEGLConfig(EGLDisplay dpy, const EGLint *attrib_list, E
return EGL_FALSE;
}
bool EGLWindow::makeCurrentGeneric(GLWindowContext context)
{
EGLContext eglContext = reinterpret_cast<EGLContext>(context);
return makeCurrent(eglContext);
}
bool EGLWindow::makeCurrent()
{
if (eglMakeCurrent(mDisplay, mSurface, mSurface, mContext) == EGL_FALSE ||
return makeCurrent(mContext);
}
bool EGLWindow::makeCurrent(EGLContext context)
{
if (eglMakeCurrent(mDisplay, mSurface, mSurface, context) == EGL_FALSE ||
eglGetError() != EGL_SUCCESS)
{
fprintf(stderr, "Error during eglMakeCurrent.\n");