Clone of mesa.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

vk_platform.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. //
  2. // File: vk_platform.h
  3. //
  4. /*
  5. ** Copyright (c) 2014-2015 The Khronos Group Inc.
  6. **
  7. ** Permission is hereby granted, free of charge, to any person obtaining a
  8. ** copy of this software and/or associated documentation files (the
  9. ** "Materials"), to deal in the Materials without restriction, including
  10. ** without limitation the rights to use, copy, modify, merge, publish,
  11. ** distribute, sublicense, and/or sell copies of the Materials, and to
  12. ** permit persons to whom the Materials are furnished to do so, subject to
  13. ** the following conditions:
  14. **
  15. ** The above copyright notice and this permission notice shall be included
  16. ** in all copies or substantial portions of the Materials.
  17. **
  18. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  21. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  22. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  25. */
  26. #ifndef __VK_PLATFORM_H__
  27. #define __VK_PLATFORM_H__
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif // __cplusplus
  32. /*
  33. ***************************************************************************************************
  34. * Platform-specific directives and type declarations
  35. ***************************************************************************************************
  36. */
  37. /* Platform-specific calling convention macros.
  38. *
  39. * Platforms should define these so that Vulkan clients call Vulkan commands
  40. * with the same calling conventions that the Vulkan implementation expects.
  41. *
  42. * VKAPI_ATTR - Placed before the return type in function declarations.
  43. * Useful for C++11 and GCC/Clang-style function attribute syntax.
  44. * VKAPI_CALL - Placed after the return type in function declarations.
  45. * Useful for MSVC-style calling convention syntax.
  46. * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
  47. *
  48. * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
  49. * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
  50. */
  51. #if defined(_WIN32)
  52. // On Windows, Vulkan commands use the stdcall convention
  53. #define VKAPI_ATTR
  54. #define VKAPI_CALL __stdcall
  55. #define VKAPI_PTR VKAPI_CALL
  56. #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
  57. // Android does not support Vulkan in native code using the "armeabi" ABI.
  58. #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
  59. #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
  60. // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
  61. // convention, even if the application's native code is compiled with the
  62. // armeabi-v7a calling convention.
  63. #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
  64. #define VKAPI_CALL
  65. #define VKAPI_PTR VKAPI_ATTR
  66. #else
  67. // On other platforms, use the default calling convention
  68. #define VKAPI_ATTR
  69. #define VKAPI_CALL
  70. #define VKAPI_PTR
  71. #endif
  72. #include <stddef.h>
  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;
  83. #else
  84. #include <stdint.h>
  85. #endif
  86. #endif // !defined(VK_NO_STDINT_H)
  87. typedef uint64_t VkDeviceSize;
  88. typedef uint32_t VkBool32;
  89. typedef uint32_t VkSampleMask;
  90. typedef uint32_t VkFlags;
  91. #if (UINTPTR_MAX >= UINT64_MAX)
  92. #define VK_UINTPTRLEAST64_MAX UINTPTR_MAX
  93. typedef uintptr_t VkUintPtrLeast64;
  94. #else
  95. #define VK_UINTPTRLEAST64_MAX UINT64_MAX
  96. typedef uint64_t VkUintPtrLeast64;
  97. #endif
  98. #ifdef __cplusplus
  99. } // extern "C"
  100. #endif // __cplusplus
  101. #endif // __VK_PLATFORM_H__