Demo application that renders a triangle using Vulkan on the Pixel 3A.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

vk_platform.h 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // File: vk_platform.h
  3. //
  4. /*
  5. ** Copyright (c) 2014-2017 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_ARCH) && __ARM_ARCH < 7
  50. #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
  51. #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
  52. // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
  53. // calling convention, i.e. float parameters are passed in registers. This
  54. // is true even if the rest of the application passes floats on the stack,
  55. // as it does by default when compiling for the armeabi-v7a NDK ABI.
  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. #endif