mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Don't make decisions based on legacy GL contexts
* This is especially relevant on Android where we fetch all function pointers at init time, so any that we replace via emulation are gone, but it is also generally true that we expect GL contexts to be representative.
This commit is contained in:
@@ -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 = {};
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user