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_icd.h 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //
  2. // File: vk_icd.h
  3. //
  4. /*
  5. * Copyright (c) 2015-2016 The Khronos Group Inc.
  6. * Copyright (c) 2015-2016 Valve Corporation
  7. * Copyright (c) 2015-2016 LunarG, Inc.
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. *
  21. */
  22. #ifndef VKICD_H
  23. #define VKICD_H
  24. #include "vulkan.h"
  25. #include <stdbool.h>
  26. // Loader-ICD version negotiation API. Versions add the following features:
  27. // Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr
  28. // or vk_icdNegotiateLoaderICDInterfaceVersion.
  29. // Version 1 - Add support for vk_icdGetInstanceProcAddr.
  30. // Version 2 - Add Loader/ICD Interface version negotiation
  31. // via vk_icdNegotiateLoaderICDInterfaceVersion.
  32. // Version 3 - Add ICD creation/destruction of KHR_surface objects.
  33. // Version 4 - Add unknown physical device extension qyering via
  34. // vk_icdGetPhysicalDeviceProcAddr.
  35. // Version 5 - Tells ICDs that the loader is now paying attention to the
  36. // application version of Vulkan passed into the ApplicationInfo
  37. // structure during vkCreateInstance. This will tell the ICD
  38. // that if the loader is older, it should automatically fail a
  39. // call for any API version > 1.0. Otherwise, the loader will
  40. // manually determine if it can support the expected version.
  41. #define CURRENT_LOADER_ICD_INTERFACE_VERSION 5
  42. #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
  43. #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4
  44. typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
  45. // This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
  46. // file directly, it won't be found.
  47. #ifndef PFN_GetPhysicalDeviceProcAddr
  48. typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
  49. #endif
  50. /*
  51. * The ICD must reserve space for a pointer for the loader's dispatch
  52. * table, at the start of <each object>.
  53. * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
  54. */
  55. #define ICD_LOADER_MAGIC 0x01CDC0DE
  56. typedef union {
  57. uintptr_t loaderMagic;
  58. void *loaderData;
  59. } VK_LOADER_DATA;
  60. static inline void set_loader_magic_value(void *pNewObject) {
  61. VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
  62. loader_info->loaderMagic = ICD_LOADER_MAGIC;
  63. }
  64. static inline bool valid_loader_magic_value(void *pNewObject) {
  65. const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
  66. return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
  67. }
  68. /*
  69. * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
  70. * contains the platform-specific connection and surface information.
  71. */
  72. typedef enum {
  73. VK_ICD_WSI_PLATFORM_MIR,
  74. VK_ICD_WSI_PLATFORM_WAYLAND,
  75. VK_ICD_WSI_PLATFORM_WIN32,
  76. VK_ICD_WSI_PLATFORM_XCB,
  77. VK_ICD_WSI_PLATFORM_XLIB,
  78. VK_ICD_WSI_PLATFORM_ANDROID,
  79. VK_ICD_WSI_PLATFORM_MACOS,
  80. VK_ICD_WSI_PLATFORM_IOS,
  81. VK_ICD_WSI_PLATFORM_DISPLAY,
  82. VK_ICD_WSI_PLATFORM_HEADLESS
  83. } VkIcdWsiPlatform;
  84. typedef struct {
  85. VkIcdWsiPlatform platform;
  86. } VkIcdSurfaceBase;
  87. #ifdef VK_USE_PLATFORM_MIR_KHR
  88. typedef struct {
  89. VkIcdSurfaceBase base;
  90. MirConnection *connection;
  91. MirSurface *mirSurface;
  92. } VkIcdSurfaceMir;
  93. #endif // VK_USE_PLATFORM_MIR_KHR
  94. #ifdef VK_USE_PLATFORM_WAYLAND_KHR
  95. typedef struct {
  96. VkIcdSurfaceBase base;
  97. struct wl_display *display;
  98. struct wl_surface *surface;
  99. } VkIcdSurfaceWayland;
  100. #endif // VK_USE_PLATFORM_WAYLAND_KHR
  101. #ifdef VK_USE_PLATFORM_WIN32_KHR
  102. typedef struct {
  103. VkIcdSurfaceBase base;
  104. HINSTANCE hinstance;
  105. HWND hwnd;
  106. } VkIcdSurfaceWin32;
  107. #endif // VK_USE_PLATFORM_WIN32_KHR
  108. #ifdef VK_USE_PLATFORM_XCB_KHR
  109. typedef struct {
  110. VkIcdSurfaceBase base;
  111. xcb_connection_t *connection;
  112. xcb_window_t window;
  113. } VkIcdSurfaceXcb;
  114. #endif // VK_USE_PLATFORM_XCB_KHR
  115. #ifdef VK_USE_PLATFORM_XLIB_KHR
  116. typedef struct {
  117. VkIcdSurfaceBase base;
  118. Display *dpy;
  119. Window window;
  120. } VkIcdSurfaceXlib;
  121. #endif // VK_USE_PLATFORM_XLIB_KHR
  122. #ifdef VK_USE_PLATFORM_ANDROID_KHR
  123. typedef struct {
  124. VkIcdSurfaceBase base;
  125. struct ANativeWindow *window;
  126. } VkIcdSurfaceAndroid;
  127. #endif // VK_USE_PLATFORM_ANDROID_KHR
  128. #ifdef VK_USE_PLATFORM_MACOS_MVK
  129. typedef struct {
  130. VkIcdSurfaceBase base;
  131. const void *pView;
  132. } VkIcdSurfaceMacOS;
  133. #endif // VK_USE_PLATFORM_MACOS_MVK
  134. #ifdef VK_USE_PLATFORM_IOS_MVK
  135. typedef struct {
  136. VkIcdSurfaceBase base;
  137. const void *pView;
  138. } VkIcdSurfaceIOS;
  139. #endif // VK_USE_PLATFORM_IOS_MVK
  140. typedef struct {
  141. VkIcdSurfaceBase base;
  142. VkDisplayModeKHR displayMode;
  143. uint32_t planeIndex;
  144. uint32_t planeStackIndex;
  145. VkSurfaceTransformFlagBitsKHR transform;
  146. float globalAlpha;
  147. VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
  148. VkExtent2D imageExtent;
  149. } VkIcdSurfaceDisplay;
  150. typedef struct {
  151. VkIcdSurfaceBase base;
  152. } VkIcdSurfaceHeadless;
  153. #endif // VKICD_H