Work around driver issues creating shared contexts on EGL. Closes #2162

* Some drivers seem to fail when trying to share between GLES2 and GLES3 though
  the spec seems to suggest this should work fine. As a workaround if the
  context fails to create, try creating with the same context client version as
  the existing context.
This commit is contained in:
baldurk
2021-01-25 11:20:21 +00:00
parent 106999a43a
commit d5fb1cfe4b
2 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -62,6 +62,8 @@ typedef EGLint(EGLAPIENTRY *PFN_eglGetError)(void);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglGetConfigAttrib)(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);
typedef const char *(EGLAPIENTRY *PFN_eglQueryString)(EGLDisplay dpy, EGLint name);
typedef EGLBoolean(EGLAPIENTRY *PFN_eglQueryContext)(EGLDisplay dpy, EGLContext ctx,
EGLint attribute, EGLint *value);
typedef PFNEGLPOSTSUBBUFFERNVPROC PFN_eglPostSubBufferNV;
typedef PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC PFN_eglSwapBuffersWithDamageEXT;
typedef PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC PFN_eglSwapBuffersWithDamageKHR;
@@ -93,7 +95,8 @@ typedef PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC PFN_eglSwapBuffersWithDamageKHR;
FUNC(Initialize, false, true); \
FUNC(QueryAPI, false, true); \
FUNC(QueryString, false, true); \
FUNC(QuerySurface, false, true);
FUNC(QuerySurface, false, true); \
FUNC(QueryContext, false, true);
struct EGLDispatchTable
{
+14
View File
@@ -79,6 +79,20 @@ class EGLPlatform : public GLPlatform
EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL_NONE};
ret.egl_ctx = EGL.CreateContext(share.egl_dpy, share.egl_cfg, share.egl_ctx, baseAttribs);
if(ret.egl_ctx == EGL_NO_CONTEXT)
{
EGL.QueryContext(share.egl_dpy, share.egl_ctx, eEGL_CONTEXT_CLIENT_VERSION, &baseAttribs[1]);
RDCWARN(
"Creating cloned context failed. Trying again with queried old EGL client version: %d",
baseAttribs[1]);
ret.egl_ctx = EGL.CreateContext(share.egl_dpy, share.egl_cfg, share.egl_ctx, baseAttribs);
if(ret.egl_ctx == EGL_NO_CONTEXT)
RDCERR("Cloned context failed again. Capture will likely fail");
}
}
return ret;