1//
2// File: vk_platform.h
3//
4/*
5** Copyright 2014-2026 The Khronos Group Inc.
6** SPDX-License-Identifier: Apache-2.0 OR MIT
7*/
8
9
10#ifndef VK_PLATFORM_H_
11#define VK_PLATFORM_H_
12
13#ifdef __cplusplus
14extern "C"
15{
16#endif // __cplusplus
17
18/*
19***************************************************************************************************
20* Platform-specific directives and type declarations
21***************************************************************************************************
22*/
23
24/* Platform-specific calling convention macros.
25 *
26 * Platforms should define these so that Vulkan clients call Vulkan commands
27 * with the same calling conventions that the Vulkan implementation expects.
28 *
29 * VKAPI_ATTR - Placed before the return type in function declarations.
30 * Useful for C++11 and GCC/Clang-style function attribute syntax.
31 * VKAPI_CALL - Placed after the return type in function declarations.
32 * Useful for MSVC-style calling convention syntax.
33 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
34 *
35 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
36 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
37 */
38#if defined(_WIN32)
39 // On Windows, Vulkan commands use the stdcall convention
40 #define VKAPI_ATTR
41 #define VKAPI_CALL __stdcall
42 #define VKAPI_PTR VKAPI_CALL
43#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
44 #error "Vulkan is not supported for the 'armeabi' NDK ABI"
45#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
46 // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
47 // calling convention, i.e. float parameters are passed in registers. This
48 // is true even if the rest of the application passes floats on the stack,
49 // as it does by default when compiling for the armeabi-v7a NDK ABI.
50 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
51 #define VKAPI_CALL
52 #define VKAPI_PTR VKAPI_ATTR
53#else
54 // On other platforms, use the default calling convention
55 #define VKAPI_ATTR
56 #define VKAPI_CALL
57 #define VKAPI_PTR
58#endif
59
60#if !defined(VK_NO_STDDEF_H)
61 #include <stddef.h>
62#endif // !defined(VK_NO_STDDEF_H)
63
64#if !defined(VK_NO_STDINT_H)
65 #if defined(_MSC_VER) && (_MSC_VER < 1600)
66 typedef signed __int8 int8_t;
67 typedef unsigned __int8 uint8_t;
68 typedef signed __int16 int16_t;
69 typedef unsigned __int16 uint16_t;
70 typedef signed __int32 int32_t;
71 typedef unsigned __int32 uint32_t;
72 typedef signed __int64 int64_t;
73 typedef unsigned __int64 uint64_t;
74 #else
75 #include <stdint.h>
76 #endif
77#endif // !defined(VK_NO_STDINT_H)
78
79#ifdef __cplusplus
80} // extern "C"
81#endif // __cplusplus
82
83#endif
84