5 ** Copyright (c) 2014-2015 The Khronos Group Inc.
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:
15 ** The above copyright notice and this permission notice shall be included
16 ** in all copies or substantial portions of the Materials.
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.
28 #ifndef __VK_PLATFORM_H__
29 #define __VK_PLATFORM_H__
37 ***************************************************************************************************
38 * Platform-specific directives and type declarations
39 ***************************************************************************************************
42 /* Platform-specific calling convention macros.
44 * Platforms should define these so that Vulkan clients call Vulkan commands
45 * with the same calling conventions that the Vulkan implementation expects.
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.
53 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
54 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
57 // On Windows, Vulkan commands use the stdcall convention
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-bit 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")))
70 #define VKAPI_PTR VKAPI_ATTR
72 // On other platforms, use the default calling convention
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;
93 #endif // !defined(VK_NO_STDINT_H)
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.
103 #ifdef VK_USE_PLATFORM_ANDROID_KHR
104 #include <android/native_window.h>
107 #ifdef VK_USE_PLATFORM_MIR_KHR
108 #include <mir_toolkit/client_types.h>
111 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
112 #include <wayland-client.h>
115 #ifdef VK_USE_PLATFORM_WIN32_KHR
119 #ifdef VK_USE_PLATFORM_XLIB_KHR
120 #include <X11/Xlib.h>
123 #ifdef VK_USE_PLATFORM_XCB_KHR
127 #endif // __VK_PLATFORM_H__