mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Change RENDERDOC_HOOK_EGL to a runtime option on an env var
* Environment variables are not user-friendly, but I don't want to promote this to a capture option since it's so niche. * In future perhaps it will be feasible to support selecting an arbitrary API to capture, or even capturing multiple APIs simultaneously - though with GLES- on-GL that will be quite difficult.
This commit is contained in:
@@ -551,9 +551,28 @@ static void EGLHooked(void *handle)
|
||||
});
|
||||
}
|
||||
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
bool ShouldHookEGL()
|
||||
{
|
||||
const char *toggle = Process::GetEnvVariable("RENDERDOC_HOOK_EGL");
|
||||
|
||||
// if the var is set to 0, then don't hook EGL
|
||||
if(toggle && toggle[0] == '0')
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void EGLHook::RegisterHooks()
|
||||
{
|
||||
#if ENABLED(RENDERDOC_HOOK_EGL)
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
if(!ShouldHookEGL())
|
||||
{
|
||||
RDCLOG("EGL hooks disabled - if GLES emulator is in use, underlying API will be captured");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
RDCLOG("Registering EGL hooks");
|
||||
|
||||
@@ -591,10 +610,4 @@ void EGLHook::RegisterHooks()
|
||||
FunctionHook("egl" STRINGIZE(func), (void **)&EGL.func, (void *)&CONCAT(egl, func)));
|
||||
EGL_HOOKED_SYMBOLS(EGL_REGISTER)
|
||||
#undef EGL_REGISTER
|
||||
|
||||
#else
|
||||
|
||||
RDCLOG("EGL hooks disabled - if GLES emulator is in use, underlying API will be captured");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ DECLARE_REFLECTION_ENUM(RDCGLenum);
|
||||
#define RENDERDOC_SUPPORT_GL
|
||||
#define RENDERDOC_SUPPORT_GLES
|
||||
|
||||
// disable this option to disallow hooking EGL on windows. This means that the underlying GL or D3D
|
||||
// calls will be captured instead.
|
||||
#define RENDERDOC_HOOK_EGL OPTION_ON
|
||||
// checks a runtime opt-out option to disallow hooking EGL on windows. This means that the
|
||||
// underlying GL or D3D calls will be captured instead.
|
||||
bool ShouldHookEGL();
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -185,11 +185,14 @@ void GLHook::RegisterHooks()
|
||||
|
||||
ForEachSupported(RegisterFunc);
|
||||
|
||||
#if ENABLED(RDOC_WIN32) && defined(RENDERDOC_SUPPORT_GLES)
|
||||
// on windows where hooking is per-library, we also need to register these hooks for any GLES2/3
|
||||
// wrapper library, when GLES support is enabled.
|
||||
libraryName = "libGLESv2.dll";
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
if(ShouldHookEGL())
|
||||
{
|
||||
// on windows where hooking is per-library, we also need to register these hooks for any GLES2/3
|
||||
// wrapper library, when GLES support is enabled.
|
||||
libraryName = "libGLESv2.dll";
|
||||
|
||||
ForEachSupported(RegisterFunc);
|
||||
ForEachSupported(RegisterFunc);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user