vulkan_header_fix.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. // Tencent is pleased to support the open source community by making ncnn available.
  2. //
  3. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  4. //
  5. // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
  6. // in compliance with the License. You may obtain a copy of the License at
  7. //
  8. // https://opensource.org/licenses/BSD-3-Clause
  9. //
  10. // Unless required by applicable law or agreed to in writing, software distributed
  11. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  13. // specific language governing permissions and limitations under the License.
  14. #ifndef NCNN_VULKAN_HEADER_FIX_H
  15. #define NCNN_VULKAN_HEADER_FIX_H
  16. #include <vulkan/vulkan.h>
  17. // This header contains new structure and function declearation to fix build with old vulkan sdk
  18. #if VK_HEADER_VERSION < 70
  19. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES (VkStructureType)1000094000
  20. typedef enum VkSubgroupFeatureFlagBits
  21. {
  22. VK_SUBGROUP_FEATURE_BASIC_BIT = 0x00000001,
  23. VK_SUBGROUP_FEATURE_VOTE_BIT = 0x00000002,
  24. VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = 0x00000004,
  25. VK_SUBGROUP_FEATURE_BALLOT_BIT = 0x00000008,
  26. VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 0x00000010,
  27. VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 0x00000020,
  28. VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 0x00000040,
  29. VK_SUBGROUP_FEATURE_QUAD_BIT = 0x00000080,
  30. VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = 0x00000100,
  31. VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
  32. } VkSubgroupFeatureFlagBits;
  33. typedef VkFlags VkSubgroupFeatureFlags;
  34. typedef struct VkPhysicalDeviceSubgroupProperties
  35. {
  36. VkStructureType sType;
  37. void* pNext;
  38. uint32_t subgroupSize;
  39. VkShaderStageFlags supportedStages;
  40. VkSubgroupFeatureFlags supportedOperations;
  41. VkBool32 quadOperationsInAllStages;
  42. } VkPhysicalDeviceSubgroupProperties;
  43. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES (VkStructureType)1000168000
  44. #define VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT (VkStructureType)1000168001
  45. typedef struct VkPhysicalDeviceMaintenance3Properties
  46. {
  47. VkStructureType sType;
  48. void* pNext;
  49. uint32_t maxPerSetDescriptors;
  50. VkDeviceSize maxMemoryAllocationSize;
  51. } VkPhysicalDeviceMaintenance3Properties;
  52. typedef struct VkDescriptorSetLayoutSupport
  53. {
  54. VkStructureType sType;
  55. void* pNext;
  56. VkBool32 supported;
  57. } VkDescriptorSetLayoutSupport;
  58. typedef VkPhysicalDeviceMaintenance3Properties VkPhysicalDeviceMaintenance3PropertiesKHR;
  59. typedef VkDescriptorSetLayoutSupport VkDescriptorSetLayoutSupportKHR;
  60. typedef void(VKAPI_PTR* PFN_vkGetDescriptorSetLayoutSupportKHR)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport);
  61. #endif // VK_HEADER_VERSION < 70
  62. #if VK_HEADER_VERSION < 80
  63. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR (VkStructureType)1000177000
  64. typedef struct VkPhysicalDevice8BitStorageFeaturesKHR
  65. {
  66. VkStructureType sType;
  67. void* pNext;
  68. VkBool32 storageBuffer8BitAccess;
  69. VkBool32 uniformAndStorageBuffer8BitAccess;
  70. VkBool32 storagePushConstant8;
  71. } VkPhysicalDevice8BitStorageFeaturesKHR;
  72. #define VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR (VkStructureType)1000109000
  73. #define VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR (VkStructureType)1000109001
  74. #define VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR (VkStructureType)1000109002
  75. #define VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2_KHR (VkStructureType)1000109003
  76. #define VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR (VkStructureType)1000109004
  77. #define VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO_KHR (VkStructureType)1000109005
  78. #define VK_STRUCTURE_TYPE_SUBPASS_END_INFO_KHR (VkStructureType)1000109006
  79. typedef struct VkAttachmentDescription2KHR
  80. {
  81. VkStructureType sType;
  82. const void* pNext;
  83. VkAttachmentDescriptionFlags flags;
  84. VkFormat format;
  85. VkSampleCountFlagBits samples;
  86. VkAttachmentLoadOp loadOp;
  87. VkAttachmentStoreOp storeOp;
  88. VkAttachmentLoadOp stencilLoadOp;
  89. VkAttachmentStoreOp stencilStoreOp;
  90. VkImageLayout initialLayout;
  91. VkImageLayout finalLayout;
  92. } VkAttachmentDescription2KHR;
  93. typedef struct VkAttachmentReference2KHR
  94. {
  95. VkStructureType sType;
  96. const void* pNext;
  97. uint32_t attachment;
  98. VkImageLayout layout;
  99. VkImageAspectFlags aspectMask;
  100. } VkAttachmentReference2KHR;
  101. typedef struct VkSubpassDescription2KHR
  102. {
  103. VkStructureType sType;
  104. const void* pNext;
  105. VkSubpassDescriptionFlags flags;
  106. VkPipelineBindPoint pipelineBindPoint;
  107. uint32_t viewMask;
  108. uint32_t inputAttachmentCount;
  109. const VkAttachmentReference2KHR* pInputAttachments;
  110. uint32_t colorAttachmentCount;
  111. const VkAttachmentReference2KHR* pColorAttachments;
  112. const VkAttachmentReference2KHR* pResolveAttachments;
  113. const VkAttachmentReference2KHR* pDepthStencilAttachment;
  114. uint32_t preserveAttachmentCount;
  115. const uint32_t* pPreserveAttachments;
  116. } VkSubpassDescription2KHR;
  117. typedef struct VkSubpassDependency2KHR
  118. {
  119. VkStructureType sType;
  120. const void* pNext;
  121. uint32_t srcSubpass;
  122. uint32_t dstSubpass;
  123. VkPipelineStageFlags srcStageMask;
  124. VkPipelineStageFlags dstStageMask;
  125. VkAccessFlags srcAccessMask;
  126. VkAccessFlags dstAccessMask;
  127. VkDependencyFlags dependencyFlags;
  128. int32_t viewOffset;
  129. } VkSubpassDependency2KHR;
  130. typedef struct VkRenderPassCreateInfo2KHR
  131. {
  132. VkStructureType sType;
  133. const void* pNext;
  134. VkRenderPassCreateFlags flags;
  135. uint32_t attachmentCount;
  136. const VkAttachmentDescription2KHR* pAttachments;
  137. uint32_t subpassCount;
  138. const VkSubpassDescription2KHR* pSubpasses;
  139. uint32_t dependencyCount;
  140. const VkSubpassDependency2KHR* pDependencies;
  141. uint32_t correlatedViewMaskCount;
  142. const uint32_t* pCorrelatedViewMasks;
  143. } VkRenderPassCreateInfo2KHR;
  144. typedef struct VkSubpassBeginInfoKHR
  145. {
  146. VkStructureType sType;
  147. const void* pNext;
  148. VkSubpassContents contents;
  149. } VkSubpassBeginInfoKHR;
  150. typedef struct VkSubpassEndInfoKHR
  151. {
  152. VkStructureType sType;
  153. const void* pNext;
  154. } VkSubpassEndInfoKHR;
  155. typedef VkResult(VKAPI_PTR* PFN_vkCreateRenderPass2KHR)(VkDevice device, const VkRenderPassCreateInfo2KHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
  156. typedef void(VKAPI_PTR* PFN_vkCmdBeginRenderPass2KHR)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfoKHR* pSubpassBeginInfo);
  157. typedef void(VKAPI_PTR* PFN_vkCmdNextSubpass2KHR)(VkCommandBuffer commandBuffer, const VkSubpassBeginInfoKHR* pSubpassBeginInfo, const VkSubpassEndInfoKHR* pSubpassEndInfo);
  158. typedef void(VKAPI_PTR* PFN_vkCmdEndRenderPass2KHR)(VkCommandBuffer commandBuffer, const VkSubpassEndInfoKHR* pSubpassEndInfo);
  159. #endif // VK_HEADER_VERSION < 80
  160. #if VK_HEADER_VERSION < 95
  161. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR (VkStructureType)1000082000
  162. typedef struct VkPhysicalDeviceFloat16Int8FeaturesKHR
  163. {
  164. VkStructureType sType;
  165. void* pNext;
  166. VkBool32 shaderFloat16;
  167. VkBool32 shaderInt8;
  168. } VkPhysicalDeviceFloat16Int8FeaturesKHR;
  169. #endif // VK_HEADER_VERSION < 95
  170. #if VK_HEADER_VERSION < 97
  171. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT (VkStructureType)1000237000
  172. typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT
  173. {
  174. VkStructureType sType;
  175. void* pNext;
  176. VkDeviceSize heapBudget[VK_MAX_MEMORY_HEAPS];
  177. VkDeviceSize heapUsage[VK_MAX_MEMORY_HEAPS];
  178. } VkPhysicalDeviceMemoryBudgetPropertiesEXT;
  179. #endif // VK_HEADER_VERSION < 97
  180. #if VK_HEADER_VERSION < 101
  181. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV (VkStructureType)1000249000
  182. #define VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV (VkStructureType)1000249001
  183. #define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV (VkStructureType)1000249002
  184. typedef enum VkComponentTypeNV
  185. {
  186. VK_COMPONENT_TYPE_FLOAT16_NV = 0,
  187. VK_COMPONENT_TYPE_FLOAT32_NV = 1,
  188. VK_COMPONENT_TYPE_FLOAT64_NV = 2,
  189. VK_COMPONENT_TYPE_SINT8_NV = 3,
  190. VK_COMPONENT_TYPE_SINT16_NV = 4,
  191. VK_COMPONENT_TYPE_SINT32_NV = 5,
  192. VK_COMPONENT_TYPE_SINT64_NV = 6,
  193. VK_COMPONENT_TYPE_UINT8_NV = 7,
  194. VK_COMPONENT_TYPE_UINT16_NV = 8,
  195. VK_COMPONENT_TYPE_UINT32_NV = 9,
  196. VK_COMPONENT_TYPE_UINT64_NV = 10,
  197. VK_COMPONENT_TYPE_BEGIN_RANGE_NV = VK_COMPONENT_TYPE_FLOAT16_NV,
  198. VK_COMPONENT_TYPE_END_RANGE_NV = VK_COMPONENT_TYPE_UINT64_NV,
  199. VK_COMPONENT_TYPE_RANGE_SIZE_NV = (VK_COMPONENT_TYPE_UINT64_NV - VK_COMPONENT_TYPE_FLOAT16_NV + 1),
  200. VK_COMPONENT_TYPE_MAX_ENUM_NV = 0x7FFFFFFF
  201. } VkComponentTypeNV;
  202. typedef enum VkScopeNV
  203. {
  204. VK_SCOPE_DEVICE_NV = 1,
  205. VK_SCOPE_WORKGROUP_NV = 2,
  206. VK_SCOPE_SUBGROUP_NV = 3,
  207. VK_SCOPE_QUEUE_FAMILY_NV = 5,
  208. VK_SCOPE_BEGIN_RANGE_NV = VK_SCOPE_DEVICE_NV,
  209. VK_SCOPE_END_RANGE_NV = VK_SCOPE_QUEUE_FAMILY_NV,
  210. VK_SCOPE_RANGE_SIZE_NV = (VK_SCOPE_QUEUE_FAMILY_NV - VK_SCOPE_DEVICE_NV + 1),
  211. VK_SCOPE_MAX_ENUM_NV = 0x7FFFFFFF
  212. } VkScopeNV;
  213. typedef struct VkCooperativeMatrixPropertiesNV
  214. {
  215. VkStructureType sType;
  216. void* pNext;
  217. uint32_t MSize;
  218. uint32_t NSize;
  219. uint32_t KSize;
  220. VkComponentTypeNV AType;
  221. VkComponentTypeNV BType;
  222. VkComponentTypeNV CType;
  223. VkComponentTypeNV DType;
  224. VkScopeNV scope;
  225. } VkCooperativeMatrixPropertiesNV;
  226. typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesNV
  227. {
  228. VkStructureType sType;
  229. void* pNext;
  230. VkBool32 cooperativeMatrix;
  231. VkBool32 cooperativeMatrixRobustBufferAccess;
  232. } VkPhysicalDeviceCooperativeMatrixFeaturesNV;
  233. typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesNV
  234. {
  235. VkStructureType sType;
  236. void* pNext;
  237. VkShaderStageFlags cooperativeMatrixSupportedStages;
  238. } VkPhysicalDeviceCooperativeMatrixPropertiesNV;
  239. typedef VkResult(VKAPI_PTR* PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkCooperativeMatrixPropertiesNV* pProperties);
  240. #endif // VK_HEADER_VERSION < 101
  241. #if VK_HEADER_VERSION < 208
  242. typedef enum VkInstanceCreateFlagBits
  243. {
  244. VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR = 0x00000001,
  245. VK_INSTANCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
  246. } VkInstanceCreateFlagBits;
  247. #endif // VK_HEADER_VERSION < 208
  248. #endif // NCNN_VULKAN_HEADER_FIX_H