mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 06:36:08 +00:00
Fix EGL order-of-operations on windows
* On windows we can load libEGL which then loads opengl32.dll, so we ensure that opengl32.dll is loaded first at startup rather than have it appear last-minute in a recursive call. * Likewise, when using EGL we forcibly forget all GL function pointers and fetch them through eglGetProcAddress, rather than having a mix-and-match dispatch table.
This commit is contained in:
@@ -535,6 +535,12 @@ static void EGLHooked(void *handle)
|
||||
EGL_NONHOOKED_SYMBOLS(EGL_FETCH)
|
||||
#undef EGL_FETCH
|
||||
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
// On windows we completely erase all GL function pointers. These might point into opengl32.dll
|
||||
// which is not what we want to call when we're using a libEGL emulator
|
||||
RDCEraseEl(GL);
|
||||
#endif
|
||||
|
||||
// Now that libEGL is loaded, we can immediately fill out any missing functions that weren't
|
||||
// library hooked by calling eglGetProcAddress.
|
||||
GL.PopulateWithCallback([](const char *funcName) {
|
||||
|
||||
@@ -534,6 +534,11 @@ void WGLHook::RegisterHooks()
|
||||
{
|
||||
RDCLOG("Registering WGL hooks");
|
||||
|
||||
// we load GL here to ensure that it is loaded by the time that we end hook registration and apply
|
||||
// any callbacks. That ensures that it doesn't get loaded later e.g. while we're in the middle of
|
||||
// loading libEGL, and break due to recursive calls.
|
||||
LoadLibraryA("opengl32.dll");
|
||||
|
||||
LibraryHooks::RegisterLibraryHook("opengl32.dll", &WGLHooked);
|
||||
LibraryHooks::RegisterLibraryHook("gdi32.dll", NULL);
|
||||
LibraryHooks::RegisterLibraryHook("user32.dll", NULL);
|
||||
|
||||
Reference in New Issue
Block a user