mirror of https://github.com/encounter/SDL.git
Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
This commit is contained in:
parent
9da4717d12
commit
37ce9f2773
|
@ -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++ */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue