X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=include%2Fvulkan%2Fvk_platform.h;h=a53e725a9a67850fc62edeff7a060ecf3d32295a;hb=aab9517f3dc5a2f28eaae4a2fa64cb0ad82bb4f7;hp=7ba8d77b875ee23ba3da19a2e2467f193f8c231f;hpb=f406b708a5dac4dc540687ab31735cdbc5455a4d;p=mesa.git diff --git a/include/vulkan/vk_platform.h b/include/vulkan/vk_platform.h index 7ba8d77b875..a53e725a9a6 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 @@ -67,24 +92,36 @@ extern "C" #endif #endif // !defined(VK_NO_STDINT_H) -typedef uint64_t VkDeviceSize; -typedef uint32_t VkBool32; +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus -typedef uint32_t VkSampleMask; -typedef uint32_t VkFlags; +// Platform-specific headers required by platform window system extensions. +// These are enabled prior to #including "vulkan.h". The same enable then +// controls inclusion of the extension interfaces in vulkan.h. -#if (UINTPTR_MAX >= UINT64_MAX) - #define VK_UINTPTRLEAST64_MAX UINTPTR_MAX +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#include +#endif - typedef uintptr_t VkUintPtrLeast64; -#else - #define VK_UINTPTRLEAST64_MAX UINT64_MAX +#ifdef VK_USE_PLATFORM_MIR_KHR +#include +#endif - typedef uint64_t VkUintPtrLeast64; +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#include #endif -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus +#ifdef VK_USE_PLATFORM_WIN32_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XCB_KHR +#include +#endif #endif // __VK_PLATFORM_H__