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