mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Just skip GL function calls if we don't have function pointers
* This is completely invalid but better than crashing. This can happen as a race-condition if the user injects into a running program that's already using GL on one thread, before we've completed installing our hooks.
This commit is contained in:
@@ -116,12 +116,26 @@ void DisableGLHooks()
|
||||
glhook.enabled = false;
|
||||
}
|
||||
|
||||
template <typename ret_type>
|
||||
ret_type default_ret()
|
||||
{
|
||||
return (ret_type)0;
|
||||
}
|
||||
|
||||
template <>
|
||||
void default_ret()
|
||||
{
|
||||
}
|
||||
|
||||
// if we were injected and aren't ready to capture, skip out and call the real function
|
||||
#define UNINIT_CALL(function, ...) \
|
||||
if(!glhook.enabled) \
|
||||
{ \
|
||||
if(GL.function == NULL) \
|
||||
{ \
|
||||
RDCERR("No function pointer for '%s' while uninitialised!", STRINGIZE(function)); \
|
||||
return default_ret<decltype(GL.function(__VA_ARGS__))>(); \
|
||||
} \
|
||||
return GL.function(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user