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...
This commit is contained in:
baldurk
2017-01-11 18:27:11 +00:00
parent d2d8a978e4
commit c5dbd7d6f0
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -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); \
}
+2 -1
View File
@@ -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); \
}