mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-16 23:10:54 +00:00
c70c116bd7
* Hooking is now done the same way across platform, with different OS implementations. * Regardless of how exactly hooks are implemented, we register libraries to hook and functions to hook within those libraries, and provide a location to store the original/onwards function pointer. This allows hooking to work whether it's done using import hooking that doesn't modify target libraries (so using dlsym or GetProcAddress will return the same value for the onwards function pointer) or whether it's implemented with prologue patching and trampolines, where we'd create an infinite loop if we did that. * We also provide stronger guarantees - the original function pointers will _always_ be made available as soon as the library is loaded, whether hooked or not, no exceptions. This means less uncertainty in hooking code about when or how onward functions will be available. * OS-specific hook functions are changed to just be implementations of LibraryHooks functions rather than indirected through macros and pre-processor definitions. * In this commit we provide some temporary functions providing the old interface to reduce churn - the library-specific hook code will be updated shortly after