2 /* File: vk_platform.h */
5 ** Copyright (c) 2014-2017 The Khronos Group Inc.
7 ** Licensed under the Apache License, Version 2.0 (the "License");
8 ** you may not use this file except in compliance with the License.
9 ** You may obtain a copy of the License at
11 ** http://www.apache.org/licenses/LICENSE-2.0
13 ** Unless required by applicable law or agreed to in writing, software
14 ** distributed under the License is distributed on an "AS IS" BASIS,
15 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 ** See the License for the specific language governing permissions and
17 ** limitations under the License.
21 #ifndef VK_PLATFORM_H_
22 #define VK_PLATFORM_H_
27 #endif /* __cplusplus */
30 ***************************************************************************************************
31 * Platform-specific directives and type declarations
32 ***************************************************************************************************
35 /* Platform-specific calling convention macros.
37 * Platforms should define these so that Vulkan clients call Vulkan commands
38 * with the same calling conventions that the Vulkan implementation expects.
40 * VKAPI_ATTR - Placed before the return type in function declarations.
41 * Useful for C++11 and GCC/Clang-style function attribute syntax.
42 * VKAPI_CALL - Placed after the return type in function declarations.
43 * Useful for MSVC-style calling convention syntax.
44 * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
46 * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
47 * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
50 /* On Windows, Vulkan commands use the stdcall convention */
52 #define VKAPI_CALL __stdcall
53 #define VKAPI_PTR VKAPI_CALL
54 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
55 #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
56 #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
57 /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
58 /* calling convention, i.e. float parameters are passed in registers. This */
59 /* is true even if the rest of the application passes floats on the stack, */
60 /* as it does by default when compiling for the armeabi-v7a NDK ABI. */
61 #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
63 #define VKAPI_PTR VKAPI_ATTR
65 /* On other platforms, use the default calling convention */
73 #if !defined(VK_NO_STDINT_H)
74 #if defined(_MSC_VER) && (_MSC_VER < 1600)
75 typedef signed __int8 int8_t;
76 typedef unsigned __int8 uint8_t;
77 typedef signed __int16 int16_t;
78 typedef unsigned __int16 uint16_t;
79 typedef signed __int32 int32_t;
80 typedef unsigned __int32 uint32_t;
81 typedef signed __int64 int64_t;
82 typedef unsigned __int64 uint64_t;
86 #endif /* !defined(VK_NO_STDINT_H) */
90 #endif /* __cplusplus */