diff options
author | Jason Ekstrand <[email protected]> | 2015-11-30 12:21:19 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-11-30 12:46:30 -0800 |
commit | f1a7c7841f4484d81d4f6c0242e04fdaea5f0933 (patch) | |
tree | 5c63e34c134a2bf9ae6bd2369d4e8051556d55ee /include/vulkan/vk_platform.h | |
parent | a89a485e79ad40793a85979d86d45760362be21a (diff) |
vk/0.210.0: Switch to the new VKAPI function decorations
While we're at it, we do a bunch of the VkResult -> void updates
Diffstat (limited to 'include/vulkan/vk_platform.h')
-rw-r--r-- | include/vulkan/vk_platform.h | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/include/vulkan/vk_platform.h b/include/vulkan/vk_platform.h index 7ba8d77b875..0f15167f742 100644 --- a/include/vulkan/vk_platform.h +++ b/include/vulkan/vk_platform.h @@ -39,15 +39,40 @@ extern "C" *************************************************************************************************** */ +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ #if defined(_WIN32) - // On Windows, VKAPI should equate to the __stdcall convention - #define VKAPI __stdcall -#elif defined(__GNUC__) - // On other platforms using GCC, VKAPI stays undefined - #define VKAPI + // On Windows, Vulkan commands use the stdcall convention + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) + // Android does not support Vulkan in native code using the "armeabi" ABI. + #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs" +#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) + // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling + // convention, even if the application's native code is compiled with the + // armeabi-v7a calling convention. + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR #else - // Unsupported Platform! - #error "Unsupported OS Platform detected!" + // On other platforms, use the default calling convention + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR #endif #include <stddef.h> |