aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobin@lunarg.com>2015-05-13 11:57:18 -0600
committerTobin Ehlis <tobin@lunarg.com>2015-05-13 11:57:18 -0600
commitb4d9a6c80f62f768d17e3173147c5de11efb5726 (patch)
tree27abf6da2e6f5d00917b53b5477f81cfb80e9eaf
parent8cf6756e49e60b7a10751e5b31e77daebf0ae13b (diff)
downloadusermoji-b4d9a6c80f62f768d17e3173147c5de11efb5726.tar.xz
loader: On Windows disable global optimization for API entrypoints
Without this change, on a Windows Release build, mhook is unable to hook the entrypoint functions.
-rw-r--r--loader/trampoline.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/loader/trampoline.c b/loader/trampoline.c
index f31bd647..2f255fbd 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -24,6 +24,12 @@
#include "loader.h"
+#if defined(WIN32)
+// On Windows need to disable global optimization for function entrypoints or
+// else mhook will not be able to hook all of them
+#pragma optimize( "g", off )
+#endif
+
/* Trampoline entrypoints */
LOADER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData)
{
@@ -1138,3 +1144,7 @@ LOADER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInf
return disp->QueuePresentWSI(queue, pPresentInfo);
}
+
+#if defined(WIN32)
+#pragma optimize( "", on )
+#endif