diff --git a/renderdoc/hooks/gl_win32_hooks.cpp b/renderdoc/hooks/gl_win32_hooks.cpp index b6759ac98..a203c0f4b 100644 --- a/renderdoc/hooks/gl_win32_hooks.cpp +++ b/renderdoc/hooks/gl_win32_hooks.cpp @@ -592,6 +592,9 @@ class OpenGLHook : LibraryHook { bool success = true; + if(wglGetProcAddress_hook() == NULL) + wglGetProcAddress_hook.SetFuncPtr(Process::GetFunctionAddress(DLL_NAME, "wglGetProcAddress")); + wglGetProcAddress_hooked("wglCreateContextAttribsARB"); #undef HookInit @@ -599,7 +602,7 @@ class OpenGLHook : LibraryHook // cheeky #undef HookExtension -#define HookExtension(funcPtrType, function) wglGetProcAddress_hook()(STRINGIZE(function)) +#define HookExtension(funcPtrType, function) wglGetProcAddress_hooked(STRINGIZE(function)) #undef HookExtensionAlias #define HookExtensionAlias(funcPtrType, function, alias) diff --git a/renderdoc/hooks/hooks.h b/renderdoc/hooks/hooks.h index 061004643..e7e197ebf 100644 --- a/renderdoc/hooks/hooks.h +++ b/renderdoc/hooks/hooks.h @@ -54,6 +54,11 @@ class Hook return (FuncType)orig_funcptr; } + void SetFuncPtr(void *ptr) + { + orig_funcptr = ptr; + } + bool Initialize(const char *function, const char *module_name, void *destination_function_ptr) { orig_funcptr = Process::GetFunctionAddress(module_name, function);