renderer_vk.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. /*
  2. * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_RENDERER_VK_H_HEADER_GUARD
  6. #define BGFX_RENDERER_VK_H_HEADER_GUARD
  7. #if BX_PLATFORM_ANDROID
  8. # define VK_USE_PLATFORM_ANDROID_KHR
  9. # define KHR_SURFACE_EXTENSION_NAME VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
  10. # define VK_IMPORT_INSTANCE_PLATFORM VK_IMPORT_INSTANCE_ANDROID
  11. #elif BX_PLATFORM_LINUX
  12. //# define VK_USE_PLATFORM_MIR_KHR
  13. # define VK_USE_PLATFORM_XLIB_KHR
  14. # define VK_USE_PLATFORM_XCB_KHR
  15. //# define VK_USE_PLATFORM_WAYLAND_KHR
  16. # define KHR_SURFACE_EXTENSION_NAME VK_KHR_XCB_SURFACE_EXTENSION_NAME
  17. # define VK_IMPORT_INSTANCE_PLATFORM VK_IMPORT_INSTANCE_LINUX
  18. #elif BX_PLATFORM_WINDOWS
  19. # define VK_USE_PLATFORM_WIN32_KHR
  20. # define KHR_SURFACE_EXTENSION_NAME VK_KHR_WIN32_SURFACE_EXTENSION_NAME
  21. # define VK_IMPORT_INSTANCE_PLATFORM VK_IMPORT_INSTANCE_WINDOWS
  22. #else
  23. # define KHR_SURFACE_EXTENSION_NAME ""
  24. # define VK_IMPORT_INSTANCE_PLATFORM
  25. #endif // BX_PLATFORM_*
  26. #define VK_NO_STDINT_H
  27. #define VK_NO_PROTOTYPES
  28. #include <vulkan/vulkan.h>
  29. #include "renderer.h"
  30. #include "debug_renderdoc.h"
  31. #define VK_IMPORT \
  32. VK_IMPORT_FUNC(false, vkCreateInstance); \
  33. VK_IMPORT_FUNC(false, vkGetInstanceProcAddr); \
  34. VK_IMPORT_FUNC(false, vkGetDeviceProcAddr); \
  35. VK_IMPORT_FUNC(false, vkEnumerateInstanceExtensionProperties); \
  36. VK_IMPORT_FUNC(false, vkEnumerateInstanceLayerProperties); \
  37. #define VK_IMPORT_INSTANCE_ANDROID \
  38. VK_IMPORT_INSTANCE_FUNC(true, vkCreateAndroidSurfaceKHR);
  39. #define VK_IMPORT_INSTANCE_LINUX \
  40. VK_IMPORT_INSTANCE_FUNC(true, vkCreateXlibSurfaceKHR); \
  41. VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXlibPresentationSupportKHR); \
  42. VK_IMPORT_INSTANCE_FUNC(true, vkCreateXcbSurfaceKHR); \
  43. VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXcbPresentationSupportKHR); \
  44. // VK_IMPORT_INSTANCE_FUNC(true, vkCreateWaylandSurfaceKHR);
  45. // VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWaylandPresentationSupportKHR);
  46. // VK_IMPORT_INSTANCE_FUNC(true, vkCreateMirSurfaceKHR);
  47. // VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceMirPresentationSupportKHR);
  48. #define VK_IMPORT_INSTANCE_WINDOWS \
  49. VK_IMPORT_INSTANCE_FUNC(true, vkCreateWin32SurfaceKHR); \
  50. VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWin32PresentationSupportKHR);
  51. #define VK_IMPORT_INSTANCE \
  52. VK_IMPORT_INSTANCE_FUNC(false, vkDestroyInstance); \
  53. VK_IMPORT_INSTANCE_FUNC(false, vkEnumeratePhysicalDevices); \
  54. VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceExtensionProperties); \
  55. VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceLayerProperties); \
  56. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceProperties); \
  57. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceFormatProperties); \
  58. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceImageFormatProperties); \
  59. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceMemoryProperties); \
  60. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceQueueFamilyProperties); \
  61. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceCapabilitiesKHR); \
  62. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceFormatsKHR); \
  63. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfacePresentModesKHR); \
  64. VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceSupportKHR); \
  65. VK_IMPORT_INSTANCE_FUNC(false, vkCreateDevice); \
  66. VK_IMPORT_INSTANCE_FUNC(false, vkDestroyDevice); \
  67. VK_IMPORT_INSTANCE_FUNC(false, vkDestroySurfaceKHR); \
  68. /* VK_EXT_debug_report */ \
  69. VK_IMPORT_INSTANCE_FUNC(true, vkCreateDebugReportCallbackEXT); \
  70. VK_IMPORT_INSTANCE_FUNC(true, vkDestroyDebugReportCallbackEXT); \
  71. VK_IMPORT_INSTANCE_FUNC(true, vkDebugReportMessageEXT); \
  72. VK_IMPORT_INSTANCE_PLATFORM
  73. #define VK_IMPORT_DEVICE \
  74. VK_IMPORT_DEVICE_FUNC(false, vkGetDeviceQueue); \
  75. VK_IMPORT_DEVICE_FUNC(false, vkCreateSwapchainKHR); \
  76. VK_IMPORT_DEVICE_FUNC(false, vkDestroySwapchainKHR); \
  77. VK_IMPORT_DEVICE_FUNC(false, vkGetSwapchainImagesKHR); \
  78. VK_IMPORT_DEVICE_FUNC(false, vkAcquireNextImageKHR); \
  79. VK_IMPORT_DEVICE_FUNC(false, vkQueuePresentKHR); \
  80. VK_IMPORT_DEVICE_FUNC(false, vkCreateFence); \
  81. VK_IMPORT_DEVICE_FUNC(false, vkDestroyFence); \
  82. VK_IMPORT_DEVICE_FUNC(false, vkCreateSemaphore); \
  83. VK_IMPORT_DEVICE_FUNC(false, vkDestroySemaphore); \
  84. VK_IMPORT_DEVICE_FUNC(false, vkResetFences); \
  85. VK_IMPORT_DEVICE_FUNC(false, vkCreateCommandPool); \
  86. VK_IMPORT_DEVICE_FUNC(false, vkDestroyCommandPool); \
  87. VK_IMPORT_DEVICE_FUNC(false, vkResetCommandPool); \
  88. VK_IMPORT_DEVICE_FUNC(false, vkAllocateCommandBuffers); \
  89. VK_IMPORT_DEVICE_FUNC(false, vkFreeCommandBuffers); \
  90. VK_IMPORT_DEVICE_FUNC(false, vkGetBufferMemoryRequirements); \
  91. VK_IMPORT_DEVICE_FUNC(false, vkGetImageMemoryRequirements); \
  92. VK_IMPORT_DEVICE_FUNC(false, vkAllocateMemory); \
  93. VK_IMPORT_DEVICE_FUNC(false, vkFreeMemory); \
  94. VK_IMPORT_DEVICE_FUNC(false, vkCreateImage); \
  95. VK_IMPORT_DEVICE_FUNC(false, vkDestroyImage); \
  96. VK_IMPORT_DEVICE_FUNC(false, vkCreateImageView); \
  97. VK_IMPORT_DEVICE_FUNC(false, vkDestroyImageView); \
  98. VK_IMPORT_DEVICE_FUNC(false, vkCreateBuffer); \
  99. VK_IMPORT_DEVICE_FUNC(false, vkDestroyBuffer); \
  100. VK_IMPORT_DEVICE_FUNC(false, vkCreateFramebuffer); \
  101. VK_IMPORT_DEVICE_FUNC(false, vkDestroyFramebuffer); \
  102. VK_IMPORT_DEVICE_FUNC(false, vkCreateRenderPass); \
  103. VK_IMPORT_DEVICE_FUNC(false, vkDestroyRenderPass); \
  104. VK_IMPORT_DEVICE_FUNC(false, vkCreateShaderModule); \
  105. VK_IMPORT_DEVICE_FUNC(false, vkDestroyShaderModule); \
  106. VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineCache); \
  107. VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineCache); \
  108. VK_IMPORT_DEVICE_FUNC(false, vkGetPipelineCacheData); \
  109. VK_IMPORT_DEVICE_FUNC(false, vkMergePipelineCaches); \
  110. VK_IMPORT_DEVICE_FUNC(false, vkCreateGraphicsPipelines); \
  111. VK_IMPORT_DEVICE_FUNC(false, vkCreateComputePipelines); \
  112. VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipeline); \
  113. VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineLayout); \
  114. VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineLayout); \
  115. VK_IMPORT_DEVICE_FUNC(false, vkCreateSampler); \
  116. VK_IMPORT_DEVICE_FUNC(false, vkDestroySampler); \
  117. VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorSetLayout); \
  118. VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorSetLayout); \
  119. VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorPool); \
  120. VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorPool); \
  121. VK_IMPORT_DEVICE_FUNC(false, vkResetDescriptorPool); \
  122. VK_IMPORT_DEVICE_FUNC(false, vkAllocateDescriptorSets); \
  123. VK_IMPORT_DEVICE_FUNC(false, vkFreeDescriptorSets); \
  124. VK_IMPORT_DEVICE_FUNC(false, vkUpdateDescriptorSets); \
  125. VK_IMPORT_DEVICE_FUNC(false, vkQueueSubmit); \
  126. VK_IMPORT_DEVICE_FUNC(false, vkQueueWaitIdle); \
  127. VK_IMPORT_DEVICE_FUNC(false, vkDeviceWaitIdle); \
  128. VK_IMPORT_DEVICE_FUNC(false, vkWaitForFences); \
  129. VK_IMPORT_DEVICE_FUNC(false, vkBeginCommandBuffer); \
  130. VK_IMPORT_DEVICE_FUNC(false, vkEndCommandBuffer); \
  131. VK_IMPORT_DEVICE_FUNC(false, vkCmdPipelineBarrier); \
  132. VK_IMPORT_DEVICE_FUNC(false, vkCmdBeginRenderPass); \
  133. VK_IMPORT_DEVICE_FUNC(false, vkCmdEndRenderPass); \
  134. VK_IMPORT_DEVICE_FUNC(false, vkCmdSetViewport); \
  135. VK_IMPORT_DEVICE_FUNC(false, vkCmdDraw); \
  136. VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexed); \
  137. VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndirect); \
  138. VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexedIndirect); \
  139. VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatch); \
  140. VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatchIndirect); \
  141. VK_IMPORT_DEVICE_FUNC(false, vkCmdBindPipeline); \
  142. VK_IMPORT_DEVICE_FUNC(false, vkCmdSetStencilReference); \
  143. VK_IMPORT_DEVICE_FUNC(false, vkCmdSetBlendConstants); \
  144. VK_IMPORT_DEVICE_FUNC(false, vkCmdSetScissor); \
  145. VK_IMPORT_DEVICE_FUNC(false, vkCmdBindDescriptorSets); \
  146. VK_IMPORT_DEVICE_FUNC(false, vkCmdBindIndexBuffer); \
  147. VK_IMPORT_DEVICE_FUNC(false, vkCmdBindVertexBuffers); \
  148. VK_IMPORT_DEVICE_FUNC(false, vkCmdUpdateBuffer); \
  149. VK_IMPORT_DEVICE_FUNC(false, vkCmdClearColorImage); \
  150. VK_IMPORT_DEVICE_FUNC(false, vkCmdClearDepthStencilImage); \
  151. VK_IMPORT_DEVICE_FUNC(false, vkCmdClearAttachments); \
  152. VK_IMPORT_DEVICE_FUNC(false, vkCmdResolveImage); \
  153. VK_IMPORT_DEVICE_FUNC(false, vkCmdCopyBuffer); \
  154. VK_IMPORT_DEVICE_FUNC(false, vkMapMemory); \
  155. VK_IMPORT_DEVICE_FUNC(false, vkUnmapMemory); \
  156. VK_IMPORT_DEVICE_FUNC(false, vkFlushMappedMemoryRanges); \
  157. VK_IMPORT_DEVICE_FUNC(false, vkInvalidateMappedMemoryRanges); \
  158. VK_IMPORT_DEVICE_FUNC(false, vkBindBufferMemory); \
  159. VK_IMPORT_DEVICE_FUNC(false, vkBindImageMemory); \
  160. /* VK_EXT_debug_marker */ \
  161. VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectTagEXT); \
  162. VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectNameEXT); \
  163. VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerBeginEXT); \
  164. VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerEndEXT); \
  165. VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerInsertEXT); \
  166. #define VK_DESTROY \
  167. VK_DESTROY_FUNC(Buffer); \
  168. VK_DESTROY_FUNC(CommandPool); \
  169. VK_DESTROY_FUNC(DescriptorPool); \
  170. VK_DESTROY_FUNC(DescriptorSetLayout); \
  171. VK_DESTROY_FUNC(Fence); \
  172. VK_DESTROY_FUNC(Framebuffer); \
  173. VK_DESTROY_FUNC(Image); \
  174. VK_DESTROY_FUNC(ImageView); \
  175. VK_DESTROY_FUNC(Pipeline); \
  176. VK_DESTROY_FUNC(PipelineCache); \
  177. VK_DESTROY_FUNC(PipelineLayout); \
  178. VK_DESTROY_FUNC(RenderPass); \
  179. VK_DESTROY_FUNC(Semaphore); \
  180. VK_DESTROY_FUNC(ShaderModule); \
  181. VK_DESTROY_FUNC(SwapchainKHR); \
  182. #define _VK_CHECK(_check, _call) \
  183. BX_MACRO_BLOCK_BEGIN \
  184. /*BX_TRACE(#_call);*/ \
  185. VkResult vkresult = _call; \
  186. _check(VK_SUCCESS == vkresult, #_call "; VK error 0x%x: %s", vkresult, getName(vkresult) ); \
  187. BX_MACRO_BLOCK_END
  188. #if BGFX_CONFIG_DEBUG
  189. # define VK_CHECK(_call) _VK_CHECK(BX_CHECK, _call)
  190. #else
  191. # define VK_CHECK(_call) _call
  192. #endif // BGFX_CONFIG_DEBUG
  193. namespace bgfx { namespace vk
  194. {
  195. #define VK_DESTROY_FUNC(_name) \
  196. struct Vk##_name \
  197. { \
  198. ::Vk##_name vk; \
  199. Vk##_name() {} \
  200. Vk##_name(::Vk##_name _vk) : vk(_vk) {} \
  201. operator ::Vk##_name() { return vk; } \
  202. operator ::Vk##_name() const { return vk; } \
  203. ::Vk##_name* operator &() { return &vk; } \
  204. const ::Vk##_name* operator &() const { return &vk; } \
  205. }; \
  206. BX_STATIC_ASSERT(sizeof(::Vk##_name) == sizeof(Vk##_name) ); \
  207. void vkDestroy(Vk##_name&)
  208. VK_DESTROY
  209. #undef VK_DESTROY_FUNC
  210. struct DslBinding
  211. {
  212. enum Enum
  213. {
  214. // CombinedImageSampler,
  215. UniformBuffer,
  216. // StorageBuffer,
  217. Count
  218. };
  219. };
  220. template<typename Ty>
  221. class StateCacheT
  222. {
  223. public:
  224. void add(uint64_t _key, Ty _value)
  225. {
  226. invalidate(_key);
  227. m_hashMap.insert(stl::make_pair(_key, _value) );
  228. }
  229. Ty find(uint64_t _key)
  230. {
  231. typename HashMap::iterator it = m_hashMap.find(_key);
  232. if (it != m_hashMap.end() )
  233. {
  234. return it->second;
  235. }
  236. return 0;
  237. }
  238. void invalidate(uint64_t _key)
  239. {
  240. typename HashMap::iterator it = m_hashMap.find(_key);
  241. if (it != m_hashMap.end() )
  242. {
  243. vkDestroy(it->second);
  244. m_hashMap.erase(it);
  245. }
  246. }
  247. void invalidate()
  248. {
  249. for (typename HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it)
  250. {
  251. vkDestroy(it->second);
  252. }
  253. m_hashMap.clear();
  254. }
  255. uint32_t getCount() const
  256. {
  257. return uint32_t(m_hashMap.size() );
  258. }
  259. private:
  260. typedef stl::unordered_map<uint64_t, Ty> HashMap;
  261. HashMap m_hashMap;
  262. };
  263. class ScratchBufferVK
  264. {
  265. public:
  266. ScratchBufferVK()
  267. {
  268. }
  269. ~ScratchBufferVK()
  270. {
  271. }
  272. void create(uint32_t _size, uint32_t _maxDescriptors);
  273. void destroy();
  274. void reset(VkDescriptorBufferInfo& _gpuAddress);
  275. void* allocUbv(VkDescriptorBufferInfo& _gpuAddress, uint32_t _size);
  276. VkDescriptorSet* m_descriptorSet;
  277. VkBuffer m_buffer;
  278. VkDeviceMemory m_deviceMem;
  279. uint8_t* m_data;
  280. uint32_t m_size;
  281. uint32_t m_pos;
  282. uint32_t m_currentDs;
  283. uint32_t m_maxDescriptors;
  284. };
  285. struct ImageVK
  286. {
  287. ImageVK()
  288. : m_memory(VK_NULL_HANDLE)
  289. , m_image(VK_NULL_HANDLE)
  290. , m_imageView(VK_NULL_HANDLE)
  291. {
  292. }
  293. VkResult create(VkFormat _format, const VkExtent3D& _extent);
  294. void destroy();
  295. VkDeviceMemory m_memory;
  296. VkImage m_image;
  297. VkImageView m_imageView;
  298. };
  299. struct BufferVK
  300. {
  301. BufferVK()
  302. : m_buffer(VK_NULL_HANDLE)
  303. , m_deviceMem(VK_NULL_HANDLE)
  304. , m_size(0)
  305. , m_flags(BGFX_BUFFER_NONE)
  306. , m_dynamic(false)
  307. {
  308. }
  309. void create(uint32_t _size, void* _data, uint16_t _flags, bool _vertex, uint32_t _stride = 0);
  310. void update(VkCommandBuffer _commandBuffer, uint32_t _offset, uint32_t _size, void* _data, bool _discard = false);
  311. void destroy();
  312. VkBuffer m_buffer;
  313. VkDeviceMemory m_deviceMem;
  314. uint32_t m_size;
  315. uint16_t m_flags;
  316. bool m_dynamic;
  317. };
  318. typedef BufferVK IndexBufferVK;
  319. struct VertexBufferVK : public BufferVK
  320. {
  321. void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags);
  322. VertexDeclHandle m_decl;
  323. };
  324. struct ShaderVK
  325. {
  326. ShaderVK()
  327. : m_code(NULL)
  328. , m_module(VK_NULL_HANDLE)
  329. , m_constantBuffer(NULL)
  330. , m_hash(0)
  331. , m_numUniforms(0)
  332. , m_numPredefined(0)
  333. {
  334. }
  335. void create(const Memory* _mem);
  336. void destroy();
  337. const Memory* m_code;
  338. VkShaderModule m_module;
  339. UniformBuffer* m_constantBuffer;
  340. PredefinedUniform m_predefined[PredefinedUniform::Count];
  341. uint16_t m_attrMask[Attrib::Count];
  342. uint8_t m_attrRemap[Attrib::Count];
  343. uint32_t m_hash;
  344. uint16_t m_numUniforms;
  345. uint16_t m_size;
  346. uint8_t m_numPredefined;
  347. uint8_t m_numAttrs;
  348. };
  349. struct ProgramVK
  350. {
  351. ProgramVK()
  352. : m_vsh(NULL)
  353. , m_fsh(NULL)
  354. {
  355. }
  356. void create(const ShaderVK* _vsh, const ShaderVK* _fsh)
  357. {
  358. BX_CHECK(NULL != _vsh->m_code, "Vertex shader doesn't exist.");
  359. m_vsh = _vsh;
  360. bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform));
  361. m_numPredefined = _vsh->m_numPredefined;
  362. if (NULL != _fsh)
  363. {
  364. BX_CHECK(NULL != _fsh->m_code, "Fragment shader doesn't exist.");
  365. m_fsh = _fsh;
  366. bx::memCopy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform));
  367. m_numPredefined += _fsh->m_numPredefined;
  368. }
  369. }
  370. void destroy()
  371. {
  372. m_numPredefined = 0;
  373. m_vsh = NULL;
  374. m_fsh = NULL;
  375. }
  376. const ShaderVK* m_vsh;
  377. const ShaderVK* m_fsh;
  378. PredefinedUniform m_predefined[PredefinedUniform::Count * 2];
  379. uint8_t m_numPredefined;
  380. };
  381. struct TextureVK
  382. {
  383. void destroy();
  384. };
  385. struct FrameBufferVK
  386. {
  387. void destroy();
  388. TextureHandle m_texture[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
  389. TextureHandle m_depth;
  390. // IDXGISwapChain* m_swapChain;
  391. uint32_t m_width;
  392. uint32_t m_height;
  393. uint16_t m_denseIdx;
  394. uint8_t m_num;
  395. uint8_t m_numTh;
  396. Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
  397. };
  398. } /* namespace bgfx */ } // namespace vk
  399. #endif // BGFX_RENDERER_VK_H_HEADER_GUARD