diff --git a/renderdoc/driver/gl/cgl_hooks.cpp b/renderdoc/driver/gl/cgl_hooks.cpp index 1d971043b..235f0872b 100644 --- a/renderdoc/driver/gl/cgl_hooks.cpp +++ b/renderdoc/driver/gl/cgl_hooks.cpp @@ -118,12 +118,13 @@ CGLError GL_EXPORT_NAME(CGLSetCurrentContext)(CGLContextObj ctx) { cglhook.contexts.insert(ctx); - FetchEnabledExtensions(); - - // see gl_emulated.cpp - GL.EmulateUnsupportedFunctions(); - GL.EmulateRequiredExtensions(); - GL.DriverForEmulation(&cglhook.driver); + if(FetchEnabledExtensions()) + { + // see gl_emulated.cpp + GL.EmulateUnsupportedFunctions(); + GL.EmulateRequiredExtensions(); + GL.DriverForEmulation(&cglhook.driver); + } } CGRect rect = {}; diff --git a/renderdoc/driver/gl/egl_hooks.cpp b/renderdoc/driver/gl/egl_hooks.cpp index 7479f4707..d6de6e0ee 100644 --- a/renderdoc/driver/gl/egl_hooks.cpp +++ b/renderdoc/driver/gl/egl_hooks.cpp @@ -458,12 +458,13 @@ HOOK_EXPORT EGLBoolean EGLAPIENTRY eglMakeCurrent_renderdoc_hooked(EGLDisplay di { eglhook.contexts.insert(ctx); - FetchEnabledExtensions(); - - // see gl_emulated.cpp - GL.EmulateUnsupportedFunctions(); - GL.EmulateRequiredExtensions(); - GL.DriverForEmulation(&eglhook.driver); + if(FetchEnabledExtensions()) + { + // see gl_emulated.cpp + GL.EmulateUnsupportedFunctions(); + GL.EmulateRequiredExtensions(); + GL.DriverForEmulation(&eglhook.driver); + } } SurfaceConfig cfg = eglhook.windows[draw]; diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index fd6bed465..6aa16ac64 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -406,19 +406,26 @@ void GetContextVersion(bool &ctxGLES, int &ctxVersion) } } -void FetchEnabledExtensions() +bool FetchEnabledExtensions() { - RDCEraseEl(HasExt); - int ctxVersion = 0; bool ctxGLES = false; GetContextVersion(ctxGLES, ctxVersion); + if((ctxGLES && ctxVersion < 20) || (!ctxGLES && ctxVersion < 30)) + { + RDCLOG("Not acting on unsupported GL context %s %d.%d", IsGLES ? "OpenGL ES" : "OpenGL", + (ctxVersion / 10), (ctxVersion % 10)); + return false; + } + + RDCLOG("Refreshing extension status based on %s %d.%d", IsGLES ? "OpenGL ES" : "OpenGL", + (ctxVersion / 10), (ctxVersion % 10)); + GLCoreVersion = RDCMAX(GLCoreVersion, ctxVersion); IsGLES = ctxGLES; - RDCLOG("Checking enabled extensions, running as %s %d.%d", IsGLES ? "OpenGL ES" : "OpenGL", - (ctxVersion / 10), (ctxVersion % 10)); + RDCEraseEl(HasExt); // only use glGetStringi on 3.0 contexts and above (ES and GL), even if we have the function // pointer @@ -461,6 +468,8 @@ void FetchEnabledExtensions() RDCERR("GL implementation has ARB_compute_shader but is not at least 4.2. Disabling compute."); HasExt[ARB_compute_shader] = false; } + + return true; } void DoVendorChecks(GLPlatform &platform, GLWindowingData context) diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index fe6fe432b..80da34eca 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -879,7 +879,7 @@ enum class ShaderType; // fills out the extension supported array and the version-specific checks above void DoVendorChecks(GLPlatform &platform, GLWindowingData context); void GetContextVersion(bool &ctxGLES, int &ctxVersion); -void FetchEnabledExtensions(); +bool FetchEnabledExtensions(); void GetGLSLVersions(ShaderType &shaderType, int &glslVersion, int &glslBaseVer, int &glslCSVer); GLuint CreateShader(GLenum shaderType, const rdcstr &src); diff --git a/renderdoc/driver/gl/glx_hooks.cpp b/renderdoc/driver/gl/glx_hooks.cpp index 409244266..5030fe8df 100644 --- a/renderdoc/driver/gl/glx_hooks.cpp +++ b/renderdoc/driver/gl/glx_hooks.cpp @@ -374,12 +374,13 @@ HOOK_EXPORT Bool glXMakeCurrent_renderdoc_hooked(Display *dpy, GLXDrawable drawa { glxhook.contexts.insert(ctx); - FetchEnabledExtensions(); - - // see gl_emulated.cpp - GL.EmulateUnsupportedFunctions(); - GL.EmulateRequiredExtensions(); - GL.DriverForEmulation(&glxhook.driver); + if(FetchEnabledExtensions()) + { + // see gl_emulated.cpp + GL.EmulateUnsupportedFunctions(); + GL.EmulateRequiredExtensions(); + GL.DriverForEmulation(&glxhook.driver); + } } GLWindowingData data; @@ -445,12 +446,13 @@ HOOK_EXPORT Bool glXMakeContextCurrent_renderdoc_hooked(Display *dpy, GLXDrawabl { glxhook.contexts.insert(ctx); - FetchEnabledExtensions(); - - // see gl_emulated.cpp - GL.EmulateUnsupportedFunctions(); - GL.EmulateRequiredExtensions(); - GL.DriverForEmulation(&glxhook.driver); + if(FetchEnabledExtensions()) + { + // see gl_emulated.cpp + GL.EmulateUnsupportedFunctions(); + GL.EmulateRequiredExtensions(); + GL.DriverForEmulation(&glxhook.driver); + } } GLWindowingData data; diff --git a/renderdoc/driver/gl/wgl_hooks.cpp b/renderdoc/driver/gl/wgl_hooks.cpp index 9a312be68..ba0037db1 100644 --- a/renderdoc/driver/gl/wgl_hooks.cpp +++ b/renderdoc/driver/gl/wgl_hooks.cpp @@ -213,12 +213,13 @@ void WGLHook::ProcessContextActivate(HGLRC rc, HDC dc) { contexts.insert(rc); - FetchEnabledExtensions(); - - // see gl_emulated.cpp - GL.EmulateUnsupportedFunctions(); - GL.EmulateRequiredExtensions(); - GL.DriverForEmulation(&driver); + if(FetchEnabledExtensions()) + { + // see gl_emulated.cpp + GL.EmulateUnsupportedFunctions(); + GL.EmulateRequiredExtensions(); + GL.DriverForEmulation(&driver); + } } GLWindowingData data;