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 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** 00012 ** http://www.apache.org/licenses/LICENSE-2.0 00013 ** 00014 ** Unless required by applicable law or agreed to in writing, software 00015 ** distributed under the License is distributed on an "AS IS" BASIS, 00016 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00017 ** See the License for the specific language governing permissions and 00018 ** limitations under the License. 00019 */ 00020 00021 00022 #ifndef VK_PLATFORM_H_ 00023 #define VK_PLATFORM_H_ 00024 00025 #ifdef __cplusplus 00026 extern "C" 00027 { 00028 #endif // __cplusplus 00029 00030 /* 00031 *************************************************************************************************** 00032 * Platform-specific directives and type declarations 00033 *************************************************************************************************** 00034 */ 00035 00036 /* Platform-specific calling convention macros. 00037 * 00038 * Platforms should define these so that Vulkan clients call Vulkan commands 00039 * with the same calling conventions that the Vulkan implementation expects. 00040 * 00041 * VKAPI_ATTR - Placed before the return type in function declarations. 00042 * Useful for C++11 and GCC/Clang-style function attribute syntax. 00043 * VKAPI_CALL - Placed after the return type in function declarations. 00044 * Useful for MSVC-style calling convention syntax. 00045 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 00046 * 00047 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 00048 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 00049 */ 00050 #if defined(_WIN32) 00051 // On Windows, Vulkan commands use the stdcall convention 00052 #define VKAPI_ATTR 00053 #define VKAPI_CALL __stdcall 00054 #define VKAPI_PTR VKAPI_CALL 00055 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 00056 #error "Vulkan isn't supported for the 'armeabi' NDK ABI" 00057 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 00058 // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 00059 // calling convention, i.e. float parameters are passed in registers. This 00060 // is true even if the rest of the application passes floats on the stack, 00061 // as it does by default when compiling for the armeabi-v7a NDK ABI. 00062 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 00063 #define VKAPI_CALL 00064 #define VKAPI_PTR VKAPI_ATTR 00065 #else 00066 // On other platforms, use the default calling convention 00067 #define VKAPI_ATTR 00068 #define VKAPI_CALL 00069 #define VKAPI_PTR 00070 #endif 00071 00072 #include <stddef.h> 00073 00074 #if !defined(VK_NO_STDINT_H) 00075 #if defined(_MSC_VER) && (_MSC_VER < 1600) 00076 typedef signed __int8 int8_t; 00077 typedef unsigned __int8 uint8_t; 00078 typedef signed __int16 int16_t; 00079 typedef unsigned __int16 uint16_t; 00080 typedef signed __int32 int32_t; 00081 typedef unsigned __int32 uint32_t; 00082 typedef signed __int64 int64_t; 00083 typedef unsigned __int64 uint64_t; 00084 #else 00085 #include <stdint.h> 00086 #endif 00087 #endif // !defined(VK_NO_STDINT_H) 00088 00089 #ifdef __cplusplus 00090 } // extern "C" 00091 #endif // __cplusplus 00092 00093 // Platform-specific headers required by platform window system extensions. 00094 // These are enabled prior to #including "vulkan.h". The same enable then 00095 // controls inclusion of the extension interfaces in vulkan.h. 00096 00097 #ifdef VK_USE_PLATFORM_ANDROID_KHR 00098 #include <android/native_window.h> 00099 #endif 00100 00101 #ifdef VK_USE_PLATFORM_MIR_KHR 00102 #include <mir_toolkit/client_types.h> 00103 #endif 00104 00105 #ifdef VK_USE_PLATFORM_WAYLAND_KHR 00106 #include <wayland-client.h> 00107 #endif 00108 00109 #ifdef VK_USE_PLATFORM_WIN32_KHR 00110 #include <windows.h> 00111 #endif 00112 00113 #ifdef VK_USE_PLATFORM_XLIB_KHR 00114 #include <X11/Xlib.h> 00115 #endif 00116 00117 #ifdef VK_USE_PLATFORM_XCB_KHR 00118 #include <xcb/xcb.h> 00119 #endif 00120 00121 #endif