mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-19 00:11:02 +00:00
Don't assign function ptrs in gl*GetProcAddress if we have one already
* In theory, gl*GetProcAddress can return different function pointers at different times, but in practice this does not happen. Also we have many more problems if there was an implementation that did this. * In reality what can happen if we don't preserve existing function pointers is that any call to gl*GetProcAddress will overwrite required emulated functions for e.g. EXT_dsa if the implementation doesn't support the extension but does return valid pointers for the query.
This commit is contained in:
@@ -43,17 +43,19 @@ Threading::CriticalSection &GetGLLock()
|
||||
return glLock;
|
||||
}
|
||||
|
||||
#define HookInit(function) \
|
||||
if(!strcmp(func, STRINGIZE(function))) \
|
||||
{ \
|
||||
GL.function = (CONCAT(function, _hooktype))realFunc; \
|
||||
return (void *)&CONCAT(function, _renderdoc_hooked); \
|
||||
#define HookInit(function) \
|
||||
if(!strcmp(func, STRINGIZE(function))) \
|
||||
{ \
|
||||
if(GL.function == NULL) \
|
||||
GL.function = (CONCAT(function, _hooktype))realFunc; \
|
||||
return (void *)&CONCAT(function, _renderdoc_hooked); \
|
||||
}
|
||||
|
||||
#define HookExtension(funcPtrType, function) \
|
||||
if(!strcmp(func, STRINGIZE(function))) \
|
||||
{ \
|
||||
GL.function = (funcPtrType)realFunc; \
|
||||
if(GL.function == NULL) \
|
||||
GL.function = (funcPtrType)realFunc; \
|
||||
return (void *)&CONCAT(function, _renderdoc_hooked); \
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,15 @@
|
||||
#define HookExtension(funcPtrType, function) \
|
||||
if(!strcmp(func, STRINGIZE(function))) \
|
||||
{ \
|
||||
glhooks.GL.function = (funcPtrType)realFunc; \
|
||||
if(glhooks.GL.function == NULL) \
|
||||
glhooks.GL.function = (funcPtrType)realFunc; \
|
||||
return (PROC)&glhooks.CONCAT(function, _hooked); \
|
||||
}
|
||||
|
||||
#define HookExtensionAlias(funcPtrType, function, alias) \
|
||||
if(!strcmp(func, STRINGIZE(alias))) \
|
||||
{ \
|
||||
if(OpenGLHook::glhooks.GL.function == NULL) \
|
||||
if(glhooks.GL.function == NULL) \
|
||||
glhooks.GL.function = (funcPtrType)realFunc; \
|
||||
return (PROC)&glhooks.CONCAT(function, _hooked); \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user