vk_platform.h
00001 // TAGRELEASE: CUSTOM 00002 // 00003 // File: vk_platform.h 00004 // 00005 /* 00006 ** Copyright (c) 2014-2015 The Khronos Group Inc. 00007 ** 00008 ** Permission is hereby granted, free of charge, to any person obtaining a 00009 ** copy of this software and/or associated documentation files (the 00010 ** "Materials"), to deal in the Materials without restriction, including 00011 ** without limitation the rights to use, copy, modify, merge, publish, 00012 ** distribute, sublicense, and/or sell copies of the Materials, and to 00013 ** permit persons to whom the Materials are furnished to do so, subject to 00014 ** the following conditions: 00015 ** 00016 ** The above copyright notice and this permission notice shall be included 00017 ** in all copies or substantial portions of the Materials. 00018 ** 00019 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00023 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 00024 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 00025 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 00026 */ 00027 00028 00029 #ifndef __VK_PLATFORM_H__ 00030 #define __VK_PLATFORM_H__ 00031 00032 #ifdef __cplusplus 00033 extern "C" 00034 { 00035 #endif // __cplusplus 00036 00037 /* 00038 *************************************************************************************************** 00039 * Platform-specific directives and type declarations 00040 *************************************************************************************************** 00041 */ 00042 00043 /* Platform-specific calling convention macros. 00044 * 00045 * Platforms should define these so that Vulkan clients call Vulkan commands 00046 * with the same calling conventions that the Vulkan implementation expects. 00047 * 00048 * VKAPI_ATTR - Placed before the return type in function declarations. 00049 * Useful for C++11 and GCC/Clang-style function attribute syntax. 00050 * VKAPI_CALL - Placed after the return type in function declarations. 00051 * Useful for MSVC-style calling convention syntax. 00052 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 00053 * 00054 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 00055 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 00056 */ 00057 #if defined(_WIN32) 00058 // On Windows, Vulkan commands use the stdcall convention 00059 #define VKAPI_ATTR 00060 #define VKAPI_CALL __stdcall 00061 #define VKAPI_PTR VKAPI_CALL 00062 #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) 00063 // Android does not support Vulkan in native code using the "armeabi" ABI. 00064 #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs" 00065 #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) 00066 // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling 00067 // convention, even if the application's native code is compiled with the 00068 // armeabi-v7a calling convention. 00069 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 00070 #define VKAPI_CALL 00071 #define VKAPI_PTR VKAPI_ATTR 00072 #else 00073 // On other platforms, use the default calling convention 00074 #define VKAPI_ATTR 00075 #define VKAPI_CALL 00076 #define VKAPI_PTR 00077 #endif 00078 00079 #include <stddef.h> 00080 00081 #if !defined(VK_NO_STDINT_H) 00082 #if defined(_MSC_VER) && (_MSC_VER < 1600) 00083 typedef signed __int8 int8_t; 00084 typedef unsigned __int8 uint8_t; 00085 typedef signed __int16 int16_t; 00086 typedef unsigned __int16 uint16_t; 00087 typedef signed __int32 int32_t; 00088 typedef unsigned __int32 uint32_t; 00089 typedef signed __int64 int64_t; 00090 typedef unsigned __int64 uint64_t; 00091 #else 00092 #include <stdint.h> 00093 #endif 00094 #endif // !defined(VK_NO_STDINT_H) 00095 00096 #ifdef __cplusplus 00097 } // extern "C" 00098 #endif // __cplusplus 00099 00100 // Platform-specific headers required by platform window system extensions. 00101 // These are enabled prior to #including "vulkan.h". The same enable then 00102 // controls inclusion of the extension interfaces in vulkan.h. 00103 00104 #ifdef VK_USE_PLATFORM_ANDROID_KHR 00105 #include <android/native_window.h> 00106 #endif 00107 00108 #ifdef VK_USE_PLATFORM_MIR_KHR 00109 #include <mir_toolkit/client_types.h> 00110 #endif 00111 00112 #ifdef VK_USE_PLATFORM_WAYLAND_KHR 00113 #include <wayland-client.h> 00114 #endif 00115 00116 #ifdef VK_USE_PLATFORM_WIN32_KHR 00117 #include <windows.h> 00118 #endif 00119 00120 #ifdef VK_USE_PLATFORM_XLIB_KHR 00121 #include <X11/Xlib.h> 00122 #endif 00123 00124 #ifdef VK_USE_PLATFORM_XCB_KHR 00125 #include <xcb/xcb.h> 00126 #endif 00127 00128 #endif // __VK_PLATFORM_H__