From 3e272e73d6414e7ce73d42d1a59a57516af6840f Mon Sep 17 00:00:00 2001
From: dv-senna <[EMAIL REDACTED]>
Date: Tue, 29 Oct 2024 18:30:10 +0100
Subject: [PATCH] SDL_vulkan.h: undefine VK_DEFINE_HANDLER and
VK_DEFINE_NON_DISPATCHABLE_HANDLE
Allows including vulkan.hpp in user code in C++ before SDL_vulkan.h w/o errors.
Fixes: https://github.com/libsdl-org/SDL/issues/11328 .
(cherry picked from commit 149ecffd6f4296fa21955c835f7be45525033bf2)
(cherry picked from commit 478dff35859a1851abf869aa873c7ca8442acdea)
---
include/SDL_vulkan.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/SDL_vulkan.h b/include/SDL_vulkan.h
index ab86a0b8656a1..a506ef456c73c 100644
--- a/include/SDL_vulkan.h
+++ b/include/SDL_vulkan.h
@@ -52,6 +52,10 @@ extern "C" {
VK_DEFINE_HANDLE(VkInstance)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+/* Make sure to undef to avoid issues in case of later vulkan include */
+#undef VK_DEFINE_HANDLE
+#undef VK_DEFINE_NON_DISPATCHABLE_HANDLE
+
#endif /* !NO_SDL_VULKAN_TYPEDEFS */
typedef VkInstance SDL_vulkanInstance;