diff --git a/renderdoc/driver/gl/egl_dispatch_table.h b/renderdoc/driver/gl/egl_dispatch_table.h index 0132e7437..c516eee6f 100644 --- a/renderdoc/driver/gl/egl_dispatch_table.h +++ b/renderdoc/driver/gl/egl_dispatch_table.h @@ -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 { diff --git a/renderdoc/driver/gl/egl_platform.cpp b/renderdoc/driver/gl/egl_platform.cpp index 2a297e322..0f4e5cdf3 100644 --- a/renderdoc/driver/gl/egl_platform.cpp +++ b/renderdoc/driver/gl/egl_platform.cpp @@ -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;