diff --git a/include/SDL.h b/include/SDL.h index 4cd6108cd..366d50fa3 100644 --- a/include/SDL.h +++ b/include/SDL.h @@ -40,10 +40,10 @@ #include "SDL_error.h" #include "SDL_events.h" #include "SDL_filesystem.h" -#include "SDL_joystick.h" #include "SDL_gamecontroller.h" #include "SDL_haptic.h" #include "SDL_hints.h" +#include "SDL_joystick.h" #include "SDL_loadso.h" #include "SDL_log.h" #include "SDL_messagebox.h" @@ -51,12 +51,12 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" #include "SDL_timer.h" #include "SDL_version.h" #include "SDL_video.h" -#include "SDL_vulkan.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ diff --git a/include/SDL_vulkan.h b/include/SDL_vulkan.h index d56c3d8a3..6c7d305f2 100644 --- a/include/SDL_vulkan.h +++ b/include/SDL_vulkan.h @@ -1,23 +1,23 @@ /* - Simple DirectMedia Layer - Copyright (C) 2017, Mark Callow. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ /** * \file SDL_vulkan.h @@ -36,8 +36,11 @@ extern "C" { #endif -/* Avoid including vulkan.h */ -#ifndef VULKAN_H_ +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; #if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) @@ -49,7 +52,7 @@ extern "C" { VK_DEFINE_HANDLE(VkInstance) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) -#endif /* !VULKAN_H_ */ +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ typedef VkInstance SDL_vulkanInstance; typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index f49534b48..1d09220f7 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -32,9 +32,9 @@ #include "SDL.h" -/* !!! FIXME: Shouldn't these be included in SDL.h? */ -#include "SDL_shape.h" +/* These headers have system specific definitions, so aren't included above */ #include "SDL_syswm.h" +#include "SDL_vulkan.h" /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 5b2bea5b4..d2709be02 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -26,7 +26,8 @@ #include "SDL_messagebox.h" #include "SDL_shape.h" #include "SDL_thread.h" -#include "SDL_vulkan.h" + +#include "SDL_vulkan_internal.h" /* The SDL video driver */ diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h index 9bcfcdab1..b42da01a6 100644 --- a/src/video/SDL_vulkan_internal.h +++ b/src/video/SDL_vulkan_internal.h @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_vulkan_internal_h -#define _SDL_vulkan_internal_h +#ifndef SDL_vulkan_internal_h_ +#define SDL_vulkan_internal_h_ #include "../SDL_internal.h" @@ -53,14 +53,13 @@ #define VK_USE_PLATFORM_XCB_KHR #endif -#if SDL_VIDEO_VULKAN_SURFACE - -/* Need vulkan.h for the following declarations. Must ensure the first - * inclusion of vulkan has the appropriate USE_PLATFORM defined, hence - * the above. */ #define VK_NO_PROTOTYPES #include "./khronos/vulkan/vulkan.h" +#include "SDL_vulkan.h" + +#if SDL_VIDEO_VULKAN_SURFACE + extern const char *SDL_Vulkan_GetResultString(VkResult result); extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( @@ -73,8 +72,8 @@ extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, const char **userNames, unsigned nameCount, const char *const *names); +#endif /* SDL_VIDEO_VULKAN_SURFACE */ -#endif +#endif /* SDL_vulkan_internal_h_ */ -#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/test/testvulkan.c b/test/testvulkan.c index 0c9f708e5..95cbec803 100644 --- a/test/testvulkan.c +++ b/test/testvulkan.c @@ -33,6 +33,7 @@ int main(int argc, char *argv[]) /* SDL includes a copy for building on systems without the Vulkan SDK */ #include "../src/video/khronos/vulkan/vulkan.h" #endif +#include "SDL_vulkan.h" #ifndef UINT64_MAX /* VS2008 */ #define UINT64_MAX 18446744073709551615