Platformer in OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.8 KiB

5 years ago
  1. //
  2. // File: vk_platform.h
  3. //
  4. /*
  5. ** Copyright (c) 2014-2015 The Khronos Group Inc.
  6. **
  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
  10. **
  11. ** http://www.apache.org/licenses/LICENSE-2.0
  12. **
  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.
  18. */
  19. #ifndef VK_PLATFORM_H_
  20. #define VK_PLATFORM_H_
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif // __cplusplus
  25. /*
  26. ***************************************************************************************************
  27. * Platform-specific directives and type declarations
  28. ***************************************************************************************************
  29. */
  30. /* Platform-specific calling convention macros.
  31. *
  32. * Platforms should define these so that Vulkan clients call Vulkan commands
  33. * with the same calling conventions that the Vulkan implementation expects.
  34. *
  35. * VKAPI_ATTR - Placed before the return type in function declarations.
  36. * Useful for C++11 and GCC/Clang-style function attribute syntax.
  37. * VKAPI_CALL - Placed after the return type in function declarations.
  38. * Useful for MSVC-style calling convention syntax.
  39. * VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
  40. *
  41. * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
  42. * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
  43. */
  44. #if defined(_WIN32)
  45. // On Windows, Vulkan commands use the stdcall convention
  46. #define VKAPI_ATTR
  47. #define VKAPI_CALL __stdcall
  48. #define VKAPI_PTR VKAPI_CALL
  49. #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
  50. // Android does not support Vulkan in native code using the "armeabi" ABI.
  51. #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
  52. #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
  53. // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
  54. // convention, even if the application's native code is compiled with the
  55. // armeabi-v7a calling convention.
  56. #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
  57. #define VKAPI_CALL
  58. #define VKAPI_PTR VKAPI_ATTR
  59. #else
  60. // On other platforms, use the default calling convention
  61. #define VKAPI_ATTR
  62. #define VKAPI_CALL
  63. #define VKAPI_PTR
  64. #endif
  65. #include <stddef.h>
  66. #if !defined(VK_NO_STDINT_H)
  67. #if defined(_MSC_VER) && (_MSC_VER < 1600)
  68. typedef signed __int8 int8_t;
  69. typedef unsigned __int8 uint8_t;
  70. typedef signed __int16 int16_t;
  71. typedef unsigned __int16 uint16_t;
  72. typedef signed __int32 int32_t;
  73. typedef unsigned __int32 uint32_t;
  74. typedef signed __int64 int64_t;
  75. typedef unsigned __int64 uint64_t;
  76. #else
  77. #include <stdint.h>
  78. #endif
  79. #endif // !defined(VK_NO_STDINT_H)
  80. #ifdef __cplusplus
  81. } // extern "C"
  82. #endif // __cplusplus
  83. // Platform-specific headers required by platform window system extensions.
  84. // These are enabled prior to #including "vulkan.h". The same enable then
  85. // controls inclusion of the extension interfaces in vulkan.h.
  86. #ifdef VK_USE_PLATFORM_ANDROID_KHR
  87. #include <android/native_window.h>
  88. #endif
  89. #ifdef VK_USE_PLATFORM_MIR_KHR
  90. #include <mir_toolkit/client_types.h>
  91. #endif
  92. #ifdef VK_USE_PLATFORM_WAYLAND_KHR
  93. #include <wayland-client.h>
  94. #endif
  95. #ifdef VK_USE_PLATFORM_WIN32_KHR
  96. #include <windows.h>
  97. #endif
  98. #ifdef VK_USE_PLATFORM_XLIB_KHR
  99. #include <X11/Xlib.h>
  100. #endif
  101. #ifdef VK_USE_PLATFORM_XCB_KHR
  102. #include <xcb/xcb.h>
  103. #endif
  104. #endif