OLD | NEW |
(Empty) | |
| 1 // |
| 2 // File: vk_platform.h |
| 3 // |
| 4 /* |
| 5 ** Copyright (c) 2014-2015 The Khronos Group Inc. |
| 6 ** |
| 7 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 8 ** copy of this software and/or associated documentation files (the |
| 9 ** "Materials"), to deal in the Materials without restriction, including |
| 10 ** without limitation the rights to use, copy, modify, merge, publish, |
| 11 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 12 ** permit persons to whom the Materials are furnished to do so, subject to |
| 13 ** the following conditions: |
| 14 ** |
| 15 ** The above copyright notice and this permission notice shall be included |
| 16 ** in all copies or substantial portions of the Materials. |
| 17 ** |
| 18 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 21 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 22 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 23 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 24 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 25 */ |
| 26 |
| 27 |
| 28 #ifndef __VK_PLATFORM_H__ |
| 29 #define __VK_PLATFORM_H__ |
| 30 |
| 31 #ifdef __cplusplus |
| 32 extern "C" |
| 33 { |
| 34 #endif // __cplusplus |
| 35 |
| 36 /* |
| 37 ********************************************************************************
******************* |
| 38 * Platform-specific directives and type declarations |
| 39 ********************************************************************************
******************* |
| 40 */ |
| 41 |
| 42 /* Platform-specific calling convention macros. |
| 43 * |
| 44 * Platforms should define these so that Vulkan clients call Vulkan commands |
| 45 * with the same calling conventions that the Vulkan implementation expects. |
| 46 * |
| 47 * VKAPI_ATTR - Placed before the return type in function declarations. |
| 48 * Useful for C++11 and GCC/Clang-style function attribute syntax. |
| 49 * VKAPI_CALL - Placed after the return type in function declarations. |
| 50 * Useful for MSVC-style calling convention syntax. |
| 51 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. |
| 52 * |
| 53 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); |
| 54 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); |
| 55 */ |
| 56 #if defined(_WIN32) |
| 57 // On Windows, Vulkan commands use the stdcall convention |
| 58 #define VKAPI_ATTR |
| 59 #define VKAPI_CALL __stdcall |
| 60 #define VKAPI_PTR VKAPI_CALL |
| 61 #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) |
| 62 // Android does not support Vulkan in native code using the "armeabi" ABI. |
| 63 #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bi
t ARM CPUs" |
| 64 #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) |
| 65 // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling |
| 66 // convention, even if the application's native code is compiled with the |
| 67 // armeabi-v7a calling convention. |
| 68 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) |
| 69 #define VKAPI_CALL |
| 70 #define VKAPI_PTR VKAPI_ATTR |
| 71 #else |
| 72 // On other platforms, use the default calling convention |
| 73 #define VKAPI_ATTR |
| 74 #define VKAPI_CALL |
| 75 #define VKAPI_PTR |
| 76 #endif |
| 77 |
| 78 #include <stddef.h> |
| 79 |
| 80 #if !defined(VK_NO_STDINT_H) |
| 81 #if defined(_MSC_VER) && (_MSC_VER < 1600) |
| 82 typedef signed __int8 int8_t; |
| 83 typedef unsigned __int8 uint8_t; |
| 84 typedef signed __int16 int16_t; |
| 85 typedef unsigned __int16 uint16_t; |
| 86 typedef signed __int32 int32_t; |
| 87 typedef unsigned __int32 uint32_t; |
| 88 typedef signed __int64 int64_t; |
| 89 typedef unsigned __int64 uint64_t; |
| 90 #else |
| 91 #include <stdint.h> |
| 92 #endif |
| 93 #endif // !defined(VK_NO_STDINT_H) |
| 94 |
| 95 #ifdef __cplusplus |
| 96 } // extern "C" |
| 97 #endif // __cplusplus |
| 98 |
| 99 // Platform-specific headers required by platform window system extensions. |
| 100 // These are enabled prior to #including "vulkan.h". The same enable then |
| 101 // controls inclusion of the extension interfaces in vulkan.h. |
| 102 |
| 103 #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 104 #include <android/native_window.h> |
| 105 #endif |
| 106 |
| 107 #ifdef VK_USE_PLATFORM_MIR_KHR |
| 108 #include <mir_toolkit/client_types.h> |
| 109 #endif |
| 110 |
| 111 #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 112 #include <wayland-client.h> |
| 113 #endif |
| 114 |
| 115 #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 116 #include <windows.h> |
| 117 #endif |
| 118 |
| 119 #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 120 #include <X11/Xlib.h> |
| 121 #endif |
| 122 |
| 123 #ifdef VK_USE_PLATFORM_XCB_KHR |
| 124 #include <xcb/xcb.h> |
| 125 #endif |
| 126 |
| 127 #endif // __VK_PLATFORM_H__ |
OLD | NEW |