aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobin@lunarg.com>2015-11-02 15:45:19 -0700
committerTobin Ehlis <tobin@lunarg.com>2015-11-03 09:01:10 -0700
commitd4bd6087b4b83fb0f3666efac484fdb440bda973 (patch)
tree8f1872ae2facc891372a0790e7763c569af926ee
parenta2514596a6f4ea865c1eb053bcee580b48f4b242 (diff)
downloadusermoji-d4bd6087b4b83fb0f3666efac484fdb440bda973.tar.xz
layers: Windows define fixes
On windows WinBase.h redefines CreateSemaphore and synchapi.h redefines CreateEvent. Depending on order or header includes, this can break the build due to VkLayerDispatchTable struct having CreateSemaphore and CreateEvent members. To fix this conflict, undef those symbols after including windows.h.
-rw-r--r--layers/swapchain.h1
-rw-r--r--layers/vk_layer_logging.h1
-rw-r--r--loader/vk_loader_platform.h8
3 files changed, 9 insertions, 1 deletions
diff --git a/layers/swapchain.h b/layers/swapchain.h
index 8d104e86..8ffae717 100644
--- a/layers/swapchain.h
+++ b/layers/swapchain.h
@@ -28,7 +28,6 @@
#ifndef SWAPCHAIN_H
#define SWAPCHAIN_H
-#include "vk_loader_platform.h"
#include "vk_layer.h"
#include "vk_debug_report_lunarg.h"
#include "vk_layer_config.h"
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index 70894f76..0f088445 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -33,6 +33,7 @@
#include <stdbool.h>
#include <unordered_map>
#include <inttypes.h>
+#include "vk_loader_platform.h"
#include "vk_layer.h"
#include "vk_layer_data.h"
#include "vk_layer_table.h"
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 5b94948b..4af76f62 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -198,6 +198,14 @@ static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_
// Headers:
#include <WinSock2.h>
#include <windows.h>
+// WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent
+// undefine them to avoid conflicts with VkLayerDispatchTable struct members.
+#ifdef CreateSemaphore
+#undef CreateSemaphore
+#endif
+#ifdef CreateEvent
+#undef CreateEvent
+#endif
#include <assert.h>
#include <stdio.h>
#include <io.h>