5 ** Copyright (c) 2014-2020 The Khronos Group Inc.
7 ** SPDX-License-Identifier: Apache-2.0
11 #ifndef VK_PLATFORM_H_
12 #define VK_PLATFORM_H_
20 ***************************************************************************************************
21 * Platform-specific directives and type declarations
22 ***************************************************************************************************
25 /* Platform-specific calling convention macros.
27 * Platforms should define these so that Vulkan clients call Vulkan commands
28 * with the same calling conventions that the Vulkan implementation expects.
30 * VKAPI_ATTR - Placed before the return type in function declarations.
31 * Useful for C++11 and GCC/Clang-style function attribute syntax.
32 * VKAPI_CALL - Placed after the return type in function declarations.
33 * Useful for MSVC-style calling convention syntax.
34 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
36 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
37 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
40 // On Windows, Vulkan commands use the stdcall convention
42 #define VKAPI_CALL __stdcall
43 #define VKAPI_PTR VKAPI_CALL
44 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
45 #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
46 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
47 // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
48 // calling convention, i.e. float parameters are passed in registers. This
49 // is true even if the rest of the application passes floats on the stack,
50 // as it does by default when compiling for the armeabi-v7a NDK ABI.
51 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
53 #define VKAPI_PTR VKAPI_ATTR
55 // On other platforms, use the default calling convention
63 #if !defined(VK_NO_STDINT_H)
64 #if defined(_MSC_VER) && (_MSC_VER < 1600)
65 typedef signed __int8
int8_t;
66 typedef unsigned __int8
uint8_t;
67 typedef signed __int16
int16_t;
68 typedef unsigned __int16
uint16_t;
69 typedef signed __int32
int32_t;
70 typedef unsigned __int32
uint32_t;
71 typedef signed __int64
int64_t;
72 typedef unsigned __int64
uint64_t;
76 #endif // !defined(VK_NO_STDINT_H)