From c5dbd7d6f05ef558cd913ea7673231e94882454f Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 11 Jan 2017 18:27:11 +0000 Subject: [PATCH] Don't allow aliases to overwrite core function pointers * This is a bit of a hack. Mesa seems to return a function pointer for functions it recognises but doesn't support. So e.g. if you query for glBindFramebuffer you'll get the implementation, if you query for glBindFramebufferEXT then you get a stub that errors out. * So in this case we ensure that any EXT/ARB aliases only set their function pointer if we don't have the core function already. This will fix some cases but obviously doesn't help if the core function is the error-stub and the extension is supported... --- renderdoc/driver/gl/gl_hooks_linux.cpp | 3 ++- renderdoc/driver/gl/gl_hooks_win32.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/gl/gl_hooks_linux.cpp b/renderdoc/driver/gl/gl_hooks_linux.cpp index 6e520d8c9..2da389490 100644 --- a/renderdoc/driver/gl/gl_hooks_linux.cpp +++ b/renderdoc/driver/gl/gl_hooks_linux.cpp @@ -75,7 +75,8 @@ void *libGLdlsymHandle = #define HookExtensionAlias(funcPtrType, function, alias) \ if(!strcmp(func, STRINGIZE(alias))) \ { \ - OpenGLHook::glhooks.GL.function = (funcPtrType)realFunc; \ + if(OpenGLHook::glhooks.GL.function == NULL) \ + OpenGLHook::glhooks.GL.function = (funcPtrType)realFunc; \ return (__GLXextFuncPtr)&CONCAT(function, _renderdoc_hooked); \ } diff --git a/renderdoc/driver/gl/gl_hooks_win32.cpp b/renderdoc/driver/gl/gl_hooks_win32.cpp index b5d956dbe..6f57b68c2 100644 --- a/renderdoc/driver/gl/gl_hooks_win32.cpp +++ b/renderdoc/driver/gl/gl_hooks_win32.cpp @@ -56,7 +56,8 @@ void EmulateUnsupportedFunctions(GLHookSet *hooks); #define HookExtensionAlias(funcPtrType, function, alias) \ if(!strcmp(func, STRINGIZE(alias))) \ { \ - glhooks.GL.function = (funcPtrType)realFunc; \ + if(OpenGLHook::glhooks.GL.function == NULL) \ + glhooks.GL.function = (funcPtrType)realFunc; \ return (PROC)&glhooks.CONCAT(function, _hooked); \ }