vk_device.cpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <bitset>
  5. #include <chrono>
  6. #include <optional>
  7. #include <string_view>
  8. #include <thread>
  9. #include <unordered_set>
  10. #include <utility>
  11. #include <vector>
  12. #include "common/assert.h"
  13. #include "core/settings.h"
  14. #include "video_core/renderer_vulkan/vk_device.h"
  15. #include "video_core/renderer_vulkan/wrapper.h"
  16. namespace Vulkan {
  17. namespace {
  18. namespace Alternatives {
  19. constexpr std::array Depth24UnormS8_UINT{
  20. VK_FORMAT_D32_SFLOAT_S8_UINT,
  21. VK_FORMAT_D16_UNORM_S8_UINT,
  22. VkFormat{},
  23. };
  24. constexpr std::array Depth16UnormS8_UINT{
  25. VK_FORMAT_D24_UNORM_S8_UINT,
  26. VK_FORMAT_D32_SFLOAT_S8_UINT,
  27. VkFormat{},
  28. };
  29. } // namespace Alternatives
  30. constexpr std::array REQUIRED_EXTENSIONS{
  31. VK_KHR_SWAPCHAIN_EXTENSION_NAME,
  32. VK_KHR_MAINTENANCE1_EXTENSION_NAME,
  33. VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME,
  34. VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME,
  35. VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
  36. VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
  37. VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME,
  38. VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME,
  39. VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME,
  40. VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME,
  41. VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME,
  42. VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME,
  43. VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME,
  44. VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME,
  45. };
  46. template <typename T>
  47. void SetNext(void**& next, T& data) {
  48. *next = &data;
  49. next = &data.pNext;
  50. }
  51. constexpr const VkFormat* GetFormatAlternatives(VkFormat format) {
  52. switch (format) {
  53. case VK_FORMAT_D24_UNORM_S8_UINT:
  54. return Alternatives::Depth24UnormS8_UINT.data();
  55. case VK_FORMAT_D16_UNORM_S8_UINT:
  56. return Alternatives::Depth16UnormS8_UINT.data();
  57. default:
  58. return nullptr;
  59. }
  60. }
  61. VkFormatFeatureFlags GetFormatFeatures(VkFormatProperties properties, FormatType format_type) {
  62. switch (format_type) {
  63. case FormatType::Linear:
  64. return properties.linearTilingFeatures;
  65. case FormatType::Optimal:
  66. return properties.optimalTilingFeatures;
  67. case FormatType::Buffer:
  68. return properties.bufferFeatures;
  69. default:
  70. return {};
  71. }
  72. }
  73. [[nodiscard]] bool IsRDNA(std::string_view device_name, VkDriverIdKHR driver_id) {
  74. static constexpr std::array RDNA_DEVICES{
  75. "5700",
  76. "5600",
  77. "5500",
  78. "5300",
  79. };
  80. if (driver_id != VK_DRIVER_ID_AMD_PROPRIETARY_KHR) {
  81. return false;
  82. }
  83. return std::any_of(RDNA_DEVICES.begin(), RDNA_DEVICES.end(), [device_name](const char* name) {
  84. return device_name.find(name) != std::string_view::npos;
  85. });
  86. }
  87. std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
  88. vk::PhysicalDevice physical, const vk::InstanceDispatch& dld) {
  89. static constexpr std::array formats{
  90. VK_FORMAT_A8B8G8R8_UNORM_PACK32,
  91. VK_FORMAT_A8B8G8R8_UINT_PACK32,
  92. VK_FORMAT_A8B8G8R8_SNORM_PACK32,
  93. VK_FORMAT_A8B8G8R8_SINT_PACK32,
  94. VK_FORMAT_A8B8G8R8_SRGB_PACK32,
  95. VK_FORMAT_B5G6R5_UNORM_PACK16,
  96. VK_FORMAT_A2B10G10R10_UNORM_PACK32,
  97. VK_FORMAT_A2B10G10R10_UINT_PACK32,
  98. VK_FORMAT_A1R5G5B5_UNORM_PACK16,
  99. VK_FORMAT_R32G32B32A32_SFLOAT,
  100. VK_FORMAT_R32G32B32A32_SINT,
  101. VK_FORMAT_R32G32B32A32_UINT,
  102. VK_FORMAT_R32G32_SFLOAT,
  103. VK_FORMAT_R32G32_SINT,
  104. VK_FORMAT_R32G32_UINT,
  105. VK_FORMAT_R16G16B16A16_SINT,
  106. VK_FORMAT_R16G16B16A16_UINT,
  107. VK_FORMAT_R16G16B16A16_SNORM,
  108. VK_FORMAT_R16G16B16A16_UNORM,
  109. VK_FORMAT_R16G16_UNORM,
  110. VK_FORMAT_R16G16_SNORM,
  111. VK_FORMAT_R16G16_SFLOAT,
  112. VK_FORMAT_R16G16_SINT,
  113. VK_FORMAT_R16_UNORM,
  114. VK_FORMAT_R16_UINT,
  115. VK_FORMAT_R8G8B8A8_SRGB,
  116. VK_FORMAT_R8G8_UNORM,
  117. VK_FORMAT_R8G8_SNORM,
  118. VK_FORMAT_R8G8_SINT,
  119. VK_FORMAT_R8G8_UINT,
  120. VK_FORMAT_R8_UNORM,
  121. VK_FORMAT_R8_SNORM,
  122. VK_FORMAT_R8_SINT,
  123. VK_FORMAT_R8_UINT,
  124. VK_FORMAT_B10G11R11_UFLOAT_PACK32,
  125. VK_FORMAT_R32_SFLOAT,
  126. VK_FORMAT_R32_UINT,
  127. VK_FORMAT_R32_SINT,
  128. VK_FORMAT_R16_SFLOAT,
  129. VK_FORMAT_R16G16B16A16_SFLOAT,
  130. VK_FORMAT_B8G8R8A8_UNORM,
  131. VK_FORMAT_B8G8R8A8_SRGB,
  132. VK_FORMAT_R4G4B4A4_UNORM_PACK16,
  133. VK_FORMAT_D32_SFLOAT,
  134. VK_FORMAT_D16_UNORM,
  135. VK_FORMAT_D16_UNORM_S8_UINT,
  136. VK_FORMAT_D24_UNORM_S8_UINT,
  137. VK_FORMAT_D32_SFLOAT_S8_UINT,
  138. VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
  139. VK_FORMAT_BC2_UNORM_BLOCK,
  140. VK_FORMAT_BC3_UNORM_BLOCK,
  141. VK_FORMAT_BC4_UNORM_BLOCK,
  142. VK_FORMAT_BC4_SNORM_BLOCK,
  143. VK_FORMAT_BC5_UNORM_BLOCK,
  144. VK_FORMAT_BC5_SNORM_BLOCK,
  145. VK_FORMAT_BC7_UNORM_BLOCK,
  146. VK_FORMAT_BC6H_UFLOAT_BLOCK,
  147. VK_FORMAT_BC6H_SFLOAT_BLOCK,
  148. VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
  149. VK_FORMAT_BC2_SRGB_BLOCK,
  150. VK_FORMAT_BC3_SRGB_BLOCK,
  151. VK_FORMAT_BC7_SRGB_BLOCK,
  152. VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
  153. VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
  154. VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
  155. VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
  156. VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
  157. VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
  158. VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
  159. VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
  160. VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
  161. VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
  162. VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
  163. VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
  164. VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
  165. VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
  166. VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
  167. VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
  168. VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
  169. VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
  170. VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
  171. VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
  172. VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
  173. VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
  174. VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
  175. VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
  176. VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
  177. VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
  178. VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
  179. VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
  180. VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
  181. VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
  182. VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
  183. VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
  184. VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
  185. };
  186. std::unordered_map<VkFormat, VkFormatProperties> format_properties;
  187. for (const auto format : formats) {
  188. format_properties.emplace(format, physical.GetFormatProperties(format));
  189. }
  190. return format_properties;
  191. }
  192. } // Anonymous namespace
  193. VKDevice::VKDevice(VkInstance instance_, u32 instance_version_, vk::PhysicalDevice physical_,
  194. VkSurfaceKHR surface, const vk::InstanceDispatch& dld_)
  195. : instance{instance_}, dld{dld_}, physical{physical_}, properties{physical.GetProperties()},
  196. instance_version{instance_version_}, format_properties{GetFormatProperties(physical, dld)} {
  197. SetupFamilies(surface);
  198. SetupFeatures();
  199. }
  200. VKDevice::~VKDevice() = default;
  201. bool VKDevice::Create() {
  202. const auto queue_cis = GetDeviceQueueCreateInfos();
  203. const std::vector extensions = LoadExtensions();
  204. VkPhysicalDeviceFeatures2 features2{
  205. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
  206. .pNext = nullptr,
  207. };
  208. const void* first_next = &features2;
  209. void** next = &features2.pNext;
  210. features2.features = {
  211. .robustBufferAccess = false,
  212. .fullDrawIndexUint32 = false,
  213. .imageCubeArray = true,
  214. .independentBlend = true,
  215. .geometryShader = true,
  216. .tessellationShader = true,
  217. .sampleRateShading = false,
  218. .dualSrcBlend = false,
  219. .logicOp = false,
  220. .multiDrawIndirect = false,
  221. .drawIndirectFirstInstance = false,
  222. .depthClamp = true,
  223. .depthBiasClamp = true,
  224. .fillModeNonSolid = false,
  225. .depthBounds = false,
  226. .wideLines = false,
  227. .largePoints = true,
  228. .alphaToOne = false,
  229. .multiViewport = true,
  230. .samplerAnisotropy = true,
  231. .textureCompressionETC2 = false,
  232. .textureCompressionASTC_LDR = is_optimal_astc_supported,
  233. .textureCompressionBC = false,
  234. .occlusionQueryPrecise = true,
  235. .pipelineStatisticsQuery = false,
  236. .vertexPipelineStoresAndAtomics = true,
  237. .fragmentStoresAndAtomics = true,
  238. .shaderTessellationAndGeometryPointSize = false,
  239. .shaderImageGatherExtended = true,
  240. .shaderStorageImageExtendedFormats = false,
  241. .shaderStorageImageMultisample = true,
  242. .shaderStorageImageReadWithoutFormat = is_formatless_image_load_supported,
  243. .shaderStorageImageWriteWithoutFormat = true,
  244. .shaderUniformBufferArrayDynamicIndexing = false,
  245. .shaderSampledImageArrayDynamicIndexing = false,
  246. .shaderStorageBufferArrayDynamicIndexing = false,
  247. .shaderStorageImageArrayDynamicIndexing = false,
  248. .shaderClipDistance = false,
  249. .shaderCullDistance = false,
  250. .shaderFloat64 = false,
  251. .shaderInt64 = false,
  252. .shaderInt16 = false,
  253. .shaderResourceResidency = false,
  254. .shaderResourceMinLod = false,
  255. .sparseBinding = false,
  256. .sparseResidencyBuffer = false,
  257. .sparseResidencyImage2D = false,
  258. .sparseResidencyImage3D = false,
  259. .sparseResidency2Samples = false,
  260. .sparseResidency4Samples = false,
  261. .sparseResidency8Samples = false,
  262. .sparseResidency16Samples = false,
  263. .sparseResidencyAliased = false,
  264. .variableMultisampleRate = false,
  265. .inheritedQueries = false,
  266. };
  267. VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore{
  268. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR,
  269. .pNext = nullptr,
  270. .timelineSemaphore = true,
  271. };
  272. SetNext(next, timeline_semaphore);
  273. VkPhysicalDevice16BitStorageFeaturesKHR bit16_storage{
  274. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR,
  275. .pNext = nullptr,
  276. .storageBuffer16BitAccess = false,
  277. .uniformAndStorageBuffer16BitAccess = true,
  278. .storagePushConstant16 = false,
  279. .storageInputOutput16 = false,
  280. };
  281. SetNext(next, bit16_storage);
  282. VkPhysicalDevice8BitStorageFeaturesKHR bit8_storage{
  283. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR,
  284. .pNext = nullptr,
  285. .storageBuffer8BitAccess = false,
  286. .uniformAndStorageBuffer8BitAccess = true,
  287. .storagePushConstant8 = false,
  288. };
  289. SetNext(next, bit8_storage);
  290. VkPhysicalDeviceHostQueryResetFeaturesEXT host_query_reset{
  291. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT,
  292. .hostQueryReset = true,
  293. };
  294. SetNext(next, host_query_reset);
  295. VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8;
  296. if (is_float16_supported) {
  297. float16_int8 = {
  298. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR,
  299. .pNext = nullptr,
  300. .shaderFloat16 = true,
  301. .shaderInt8 = false,
  302. };
  303. SetNext(next, float16_int8);
  304. } else {
  305. LOG_INFO(Render_Vulkan, "Device doesn't support float16 natively");
  306. }
  307. if (!nv_viewport_swizzle) {
  308. LOG_INFO(Render_Vulkan, "Device doesn't support viewport swizzles");
  309. }
  310. VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR std430_layout;
  311. if (khr_uniform_buffer_standard_layout) {
  312. std430_layout = {
  313. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR,
  314. .pNext = nullptr,
  315. .uniformBufferStandardLayout = true,
  316. };
  317. SetNext(next, std430_layout);
  318. } else {
  319. LOG_INFO(Render_Vulkan, "Device doesn't support packed UBOs");
  320. }
  321. VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8;
  322. if (ext_index_type_uint8) {
  323. index_type_uint8 = {
  324. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT,
  325. .pNext = nullptr,
  326. .indexTypeUint8 = true,
  327. };
  328. SetNext(next, index_type_uint8);
  329. } else {
  330. LOG_INFO(Render_Vulkan, "Device doesn't support uint8 indexes");
  331. }
  332. VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback;
  333. if (ext_transform_feedback) {
  334. transform_feedback = {
  335. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT,
  336. .pNext = nullptr,
  337. .transformFeedback = true,
  338. .geometryStreams = true,
  339. };
  340. SetNext(next, transform_feedback);
  341. } else {
  342. LOG_INFO(Render_Vulkan, "Device doesn't support transform feedbacks");
  343. }
  344. VkPhysicalDeviceCustomBorderColorFeaturesEXT custom_border;
  345. if (ext_custom_border_color) {
  346. custom_border = {
  347. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT,
  348. .pNext = nullptr,
  349. .customBorderColors = VK_TRUE,
  350. .customBorderColorWithoutFormat = VK_TRUE,
  351. };
  352. SetNext(next, custom_border);
  353. } else {
  354. LOG_INFO(Render_Vulkan, "Device doesn't support custom border colors");
  355. }
  356. VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state;
  357. if (ext_extended_dynamic_state) {
  358. dynamic_state = {
  359. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT,
  360. .pNext = nullptr,
  361. .extendedDynamicState = VK_TRUE,
  362. };
  363. SetNext(next, dynamic_state);
  364. } else {
  365. LOG_INFO(Render_Vulkan, "Device doesn't support extended dynamic state");
  366. }
  367. VkPhysicalDeviceRobustness2FeaturesEXT robustness2;
  368. if (ext_robustness2) {
  369. robustness2 = {
  370. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT,
  371. .pNext = nullptr,
  372. .robustBufferAccess2 = false,
  373. .robustImageAccess2 = true,
  374. .nullDescriptor = true,
  375. };
  376. SetNext(next, robustness2);
  377. } else {
  378. LOG_INFO(Render_Vulkan, "Device doesn't support robustness2");
  379. }
  380. if (!ext_depth_range_unrestricted) {
  381. LOG_INFO(Render_Vulkan, "Device doesn't support depth range unrestricted");
  382. }
  383. VkDeviceDiagnosticsConfigCreateInfoNV diagnostics_nv;
  384. if (nv_device_diagnostics_config) {
  385. nsight_aftermath_tracker.Initialize();
  386. diagnostics_nv = {
  387. .sType = VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV,
  388. .pNext = &features2,
  389. .flags = VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV |
  390. VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV |
  391. VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV,
  392. };
  393. first_next = &diagnostics_nv;
  394. }
  395. logical = vk::Device::Create(physical, queue_cis, extensions, first_next, dld);
  396. if (!logical) {
  397. LOG_ERROR(Render_Vulkan, "Failed to create logical device");
  398. return false;
  399. }
  400. CollectTelemetryParameters();
  401. CollectToolingInfo();
  402. if (ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_MESA_RADV) {
  403. LOG_WARNING(
  404. Render_Vulkan,
  405. "Blacklisting RADV for VK_EXT_extended_dynamic state, likely due to a bug in yuzu");
  406. ext_extended_dynamic_state = false;
  407. }
  408. if (ext_extended_dynamic_state && IsRDNA(properties.deviceName, driver_id)) {
  409. // AMD's proprietary driver supports VK_EXT_extended_dynamic_state but on RDNA devices it
  410. // seems to cause stability issues
  411. LOG_WARNING(
  412. Render_Vulkan,
  413. "Blacklisting AMD proprietary on RDNA devices from VK_EXT_extended_dynamic_state");
  414. ext_extended_dynamic_state = false;
  415. }
  416. graphics_queue = logical.GetQueue(graphics_family);
  417. present_queue = logical.GetQueue(present_family);
  418. use_asynchronous_shaders = Settings::values.use_asynchronous_shaders.GetValue();
  419. return true;
  420. }
  421. VkFormat VKDevice::GetSupportedFormat(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,
  422. FormatType format_type) const {
  423. if (IsFormatSupported(wanted_format, wanted_usage, format_type)) {
  424. return wanted_format;
  425. }
  426. // The wanted format is not supported by hardware, search for alternatives
  427. const VkFormat* alternatives = GetFormatAlternatives(wanted_format);
  428. if (alternatives == nullptr) {
  429. UNREACHABLE_MSG("Format={} with usage={} and type={} has no defined alternatives and host "
  430. "hardware does not support it",
  431. wanted_format, wanted_usage, format_type);
  432. return wanted_format;
  433. }
  434. std::size_t i = 0;
  435. for (VkFormat alternative = *alternatives; alternative; alternative = alternatives[++i]) {
  436. if (!IsFormatSupported(alternative, wanted_usage, format_type)) {
  437. continue;
  438. }
  439. LOG_WARNING(Render_Vulkan,
  440. "Emulating format={} with alternative format={} with usage={} and type={}",
  441. wanted_format, alternative, wanted_usage, format_type);
  442. return alternative;
  443. }
  444. // No alternatives found, panic
  445. UNREACHABLE_MSG("Format={} with usage={} and type={} is not supported by the host hardware and "
  446. "doesn't support any of the alternatives",
  447. wanted_format, wanted_usage, format_type);
  448. return wanted_format;
  449. }
  450. void VKDevice::ReportLoss() const {
  451. LOG_CRITICAL(Render_Vulkan, "Device loss occurred!");
  452. // Wait for the log to flush and for Nsight Aftermath to dump the results
  453. std::this_thread::sleep_for(std::chrono::seconds{15});
  454. }
  455. void VKDevice::SaveShader(const std::vector<u32>& spirv) const {
  456. nsight_aftermath_tracker.SaveShader(spirv);
  457. }
  458. bool VKDevice::IsOptimalAstcSupported(const VkPhysicalDeviceFeatures& features) const {
  459. // Disable for now to avoid converting ASTC twice.
  460. static constexpr std::array astc_formats = {
  461. VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
  462. VK_FORMAT_ASTC_5x4_UNORM_BLOCK, VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
  463. VK_FORMAT_ASTC_5x5_UNORM_BLOCK, VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
  464. VK_FORMAT_ASTC_6x5_UNORM_BLOCK, VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
  465. VK_FORMAT_ASTC_6x6_UNORM_BLOCK, VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
  466. VK_FORMAT_ASTC_8x5_UNORM_BLOCK, VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
  467. VK_FORMAT_ASTC_8x6_UNORM_BLOCK, VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
  468. VK_FORMAT_ASTC_8x8_UNORM_BLOCK, VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
  469. VK_FORMAT_ASTC_10x5_UNORM_BLOCK, VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
  470. VK_FORMAT_ASTC_10x6_UNORM_BLOCK, VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
  471. VK_FORMAT_ASTC_10x8_UNORM_BLOCK, VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
  472. VK_FORMAT_ASTC_10x10_UNORM_BLOCK, VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
  473. VK_FORMAT_ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
  474. VK_FORMAT_ASTC_12x12_UNORM_BLOCK, VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
  475. };
  476. if (!features.textureCompressionASTC_LDR) {
  477. return false;
  478. }
  479. const auto format_feature_usage{
  480. VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
  481. VK_FORMAT_FEATURE_BLIT_DST_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
  482. VK_FORMAT_FEATURE_TRANSFER_DST_BIT};
  483. for (const auto format : astc_formats) {
  484. const auto physical_format_properties{physical.GetFormatProperties(format)};
  485. if ((physical_format_properties.optimalTilingFeatures & format_feature_usage) == 0) {
  486. return false;
  487. }
  488. }
  489. return true;
  490. }
  491. bool VKDevice::TestDepthStencilBlits() const {
  492. static constexpr VkFormatFeatureFlags required_features =
  493. VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT;
  494. const auto test_features = [](VkFormatProperties props) {
  495. return (props.optimalTilingFeatures & required_features) == required_features;
  496. };
  497. return test_features(format_properties.at(VK_FORMAT_D32_SFLOAT_S8_UINT)) &&
  498. test_features(format_properties.at(VK_FORMAT_D24_UNORM_S8_UINT));
  499. }
  500. bool VKDevice::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags wanted_usage,
  501. FormatType format_type) const {
  502. const auto it = format_properties.find(wanted_format);
  503. if (it == format_properties.end()) {
  504. UNIMPLEMENTED_MSG("Unimplemented format query={}", wanted_format);
  505. return true;
  506. }
  507. const auto supported_usage = GetFormatFeatures(it->second, format_type);
  508. return (supported_usage & wanted_usage) == wanted_usage;
  509. }
  510. bool VKDevice::IsSuitable(vk::PhysicalDevice physical, VkSurfaceKHR surface) {
  511. bool is_suitable = true;
  512. std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions;
  513. for (const auto& prop : physical.EnumerateDeviceExtensionProperties()) {
  514. for (std::size_t i = 0; i < REQUIRED_EXTENSIONS.size(); ++i) {
  515. if (available_extensions[i]) {
  516. continue;
  517. }
  518. const std::string_view name{prop.extensionName};
  519. available_extensions[i] = name == REQUIRED_EXTENSIONS[i];
  520. }
  521. }
  522. if (!available_extensions.all()) {
  523. for (std::size_t i = 0; i < REQUIRED_EXTENSIONS.size(); ++i) {
  524. if (available_extensions[i]) {
  525. continue;
  526. }
  527. LOG_ERROR(Render_Vulkan, "Missing required extension: {}", REQUIRED_EXTENSIONS[i]);
  528. is_suitable = false;
  529. }
  530. }
  531. bool has_graphics{}, has_present{};
  532. const std::vector queue_family_properties = physical.GetQueueFamilyProperties();
  533. for (u32 i = 0; i < static_cast<u32>(queue_family_properties.size()); ++i) {
  534. const auto& family = queue_family_properties[i];
  535. if (family.queueCount == 0) {
  536. continue;
  537. }
  538. has_graphics |= family.queueFlags & VK_QUEUE_GRAPHICS_BIT;
  539. has_present |= physical.GetSurfaceSupportKHR(i, surface);
  540. }
  541. if (!has_graphics || !has_present) {
  542. LOG_ERROR(Render_Vulkan, "Device lacks a graphics and present queue");
  543. is_suitable = false;
  544. }
  545. // TODO(Rodrigo): Check if the device matches all requeriments.
  546. const auto properties{physical.GetProperties()};
  547. const auto& limits{properties.limits};
  548. constexpr u32 required_ubo_size = 65536;
  549. if (limits.maxUniformBufferRange < required_ubo_size) {
  550. LOG_ERROR(Render_Vulkan, "Device UBO size {} is too small, {} is required",
  551. limits.maxUniformBufferRange, required_ubo_size);
  552. is_suitable = false;
  553. }
  554. constexpr u32 required_num_viewports = 16;
  555. if (limits.maxViewports < required_num_viewports) {
  556. LOG_INFO(Render_Vulkan, "Device number of viewports {} is too small, {} is required",
  557. limits.maxViewports, required_num_viewports);
  558. is_suitable = false;
  559. }
  560. const auto features{physical.GetFeatures()};
  561. const std::array feature_report = {
  562. std::make_pair(features.vertexPipelineStoresAndAtomics, "vertexPipelineStoresAndAtomics"),
  563. std::make_pair(features.imageCubeArray, "imageCubeArray"),
  564. std::make_pair(features.independentBlend, "independentBlend"),
  565. std::make_pair(features.depthClamp, "depthClamp"),
  566. std::make_pair(features.samplerAnisotropy, "samplerAnisotropy"),
  567. std::make_pair(features.largePoints, "largePoints"),
  568. std::make_pair(features.multiViewport, "multiViewport"),
  569. std::make_pair(features.depthBiasClamp, "depthBiasClamp"),
  570. std::make_pair(features.geometryShader, "geometryShader"),
  571. std::make_pair(features.tessellationShader, "tessellationShader"),
  572. std::make_pair(features.occlusionQueryPrecise, "occlusionQueryPrecise"),
  573. std::make_pair(features.fragmentStoresAndAtomics, "fragmentStoresAndAtomics"),
  574. std::make_pair(features.shaderImageGatherExtended, "shaderImageGatherExtended"),
  575. std::make_pair(features.shaderStorageImageMultisample, "shaderStorageImageMultisample"),
  576. std::make_pair(features.shaderStorageImageWriteWithoutFormat,
  577. "shaderStorageImageWriteWithoutFormat"),
  578. };
  579. for (const auto& [supported, name] : feature_report) {
  580. if (supported) {
  581. continue;
  582. }
  583. LOG_ERROR(Render_Vulkan, "Missing required feature: {}", name);
  584. is_suitable = false;
  585. }
  586. if (!is_suitable) {
  587. LOG_ERROR(Render_Vulkan, "{} is not suitable", properties.deviceName);
  588. }
  589. return is_suitable;
  590. }
  591. std::vector<const char*> VKDevice::LoadExtensions() {
  592. std::vector<const char*> extensions;
  593. extensions.reserve(7 + REQUIRED_EXTENSIONS.size());
  594. extensions.insert(extensions.begin(), REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end());
  595. bool has_khr_shader_float16_int8{};
  596. bool has_ext_subgroup_size_control{};
  597. bool has_ext_transform_feedback{};
  598. bool has_ext_custom_border_color{};
  599. bool has_ext_extended_dynamic_state{};
  600. bool has_ext_robustness2{};
  601. for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) {
  602. const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name,
  603. bool push) {
  604. if (extension.extensionName != std::string_view(name)) {
  605. return;
  606. }
  607. if (push) {
  608. extensions.push_back(name);
  609. }
  610. if (status) {
  611. status->get() = true;
  612. }
  613. };
  614. test(nv_viewport_swizzle, VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME, true);
  615. test(khr_uniform_buffer_standard_layout,
  616. VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true);
  617. test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false);
  618. test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true);
  619. test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true);
  620. test(ext_sampler_filter_minmax, VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, true);
  621. test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME,
  622. true);
  623. test(ext_tooling_info, VK_EXT_TOOLING_INFO_EXTENSION_NAME, true);
  624. test(ext_shader_stencil_export, VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME, true);
  625. test(has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, false);
  626. test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false);
  627. test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false);
  628. test(has_ext_robustness2, VK_EXT_ROBUSTNESS_2_EXTENSION_NAME, false);
  629. if (instance_version >= VK_API_VERSION_1_1) {
  630. test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false);
  631. }
  632. if (Settings::values.renderer_debug) {
  633. test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME,
  634. true);
  635. }
  636. }
  637. VkPhysicalDeviceFeatures2KHR features;
  638. features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
  639. VkPhysicalDeviceProperties2KHR physical_properties;
  640. physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
  641. if (has_khr_shader_float16_int8) {
  642. VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features;
  643. float16_int8_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR;
  644. float16_int8_features.pNext = nullptr;
  645. features.pNext = &float16_int8_features;
  646. physical.GetFeatures2KHR(features);
  647. is_float16_supported = float16_int8_features.shaderFloat16;
  648. extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
  649. }
  650. if (has_ext_subgroup_size_control) {
  651. VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_features;
  652. subgroup_features.sType =
  653. VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT;
  654. subgroup_features.pNext = nullptr;
  655. features.pNext = &subgroup_features;
  656. physical.GetFeatures2KHR(features);
  657. VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroup_properties;
  658. subgroup_properties.sType =
  659. VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT;
  660. subgroup_properties.pNext = nullptr;
  661. physical_properties.pNext = &subgroup_properties;
  662. physical.GetProperties2KHR(physical_properties);
  663. is_warp_potentially_bigger = subgroup_properties.maxSubgroupSize > GuestWarpSize;
  664. if (subgroup_features.subgroupSizeControl &&
  665. subgroup_properties.minSubgroupSize <= GuestWarpSize &&
  666. subgroup_properties.maxSubgroupSize >= GuestWarpSize) {
  667. extensions.push_back(VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME);
  668. guest_warp_stages = subgroup_properties.requiredSubgroupSizeStages;
  669. }
  670. } else {
  671. is_warp_potentially_bigger = true;
  672. }
  673. if (has_ext_transform_feedback) {
  674. VkPhysicalDeviceTransformFeedbackFeaturesEXT tfb_features;
  675. tfb_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
  676. tfb_features.pNext = nullptr;
  677. features.pNext = &tfb_features;
  678. physical.GetFeatures2KHR(features);
  679. VkPhysicalDeviceTransformFeedbackPropertiesEXT tfb_properties;
  680. tfb_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT;
  681. tfb_properties.pNext = nullptr;
  682. physical_properties.pNext = &tfb_properties;
  683. physical.GetProperties2KHR(physical_properties);
  684. if (tfb_features.transformFeedback && tfb_features.geometryStreams &&
  685. tfb_properties.maxTransformFeedbackStreams >= 4 &&
  686. tfb_properties.maxTransformFeedbackBuffers && tfb_properties.transformFeedbackQueries &&
  687. tfb_properties.transformFeedbackDraw) {
  688. extensions.push_back(VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME);
  689. ext_transform_feedback = true;
  690. }
  691. }
  692. if (has_ext_custom_border_color) {
  693. VkPhysicalDeviceCustomBorderColorFeaturesEXT border_features;
  694. border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
  695. border_features.pNext = nullptr;
  696. features.pNext = &border_features;
  697. physical.GetFeatures2KHR(features);
  698. if (border_features.customBorderColors && border_features.customBorderColorWithoutFormat) {
  699. extensions.push_back(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
  700. ext_custom_border_color = true;
  701. }
  702. }
  703. if (has_ext_extended_dynamic_state) {
  704. VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state;
  705. dynamic_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT;
  706. dynamic_state.pNext = nullptr;
  707. features.pNext = &dynamic_state;
  708. physical.GetFeatures2KHR(features);
  709. if (dynamic_state.extendedDynamicState) {
  710. extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
  711. ext_extended_dynamic_state = true;
  712. }
  713. }
  714. if (has_ext_robustness2) {
  715. VkPhysicalDeviceRobustness2FeaturesEXT robustness2;
  716. robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT;
  717. robustness2.pNext = nullptr;
  718. features.pNext = &robustness2;
  719. physical.GetFeatures2KHR(features);
  720. if (robustness2.nullDescriptor && robustness2.robustImageAccess2) {
  721. extensions.push_back(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
  722. ext_robustness2 = true;
  723. }
  724. }
  725. return extensions;
  726. }
  727. void VKDevice::SetupFamilies(VkSurfaceKHR surface) {
  728. std::optional<u32> graphics_family_, present_family_;
  729. const std::vector queue_family_properties = physical.GetQueueFamilyProperties();
  730. for (u32 i = 0; i < static_cast<u32>(queue_family_properties.size()); ++i) {
  731. if (graphics_family_ && present_family_)
  732. break;
  733. const auto& queue_family = queue_family_properties[i];
  734. if (queue_family.queueCount == 0)
  735. continue;
  736. if (queue_family.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
  737. graphics_family_ = i;
  738. }
  739. if (physical.GetSurfaceSupportKHR(i, surface)) {
  740. present_family_ = i;
  741. }
  742. }
  743. ASSERT(graphics_family_ && present_family_);
  744. graphics_family = *graphics_family_;
  745. present_family = *present_family_;
  746. }
  747. void VKDevice::SetupFeatures() {
  748. const auto supported_features{physical.GetFeatures()};
  749. is_formatless_image_load_supported = supported_features.shaderStorageImageReadWithoutFormat;
  750. is_blit_depth_stencil_supported = TestDepthStencilBlits();
  751. is_optimal_astc_supported = IsOptimalAstcSupported(supported_features);
  752. }
  753. void VKDevice::CollectTelemetryParameters() {
  754. VkPhysicalDeviceDriverPropertiesKHR driver{
  755. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR,
  756. .pNext = nullptr,
  757. .driverID = {},
  758. .driverName = {},
  759. .driverInfo = {},
  760. .conformanceVersion = {},
  761. };
  762. VkPhysicalDeviceProperties2KHR device_properties{
  763. .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR,
  764. .pNext = &driver,
  765. .properties = {},
  766. };
  767. physical.GetProperties2KHR(device_properties);
  768. driver_id = driver.driverID;
  769. vendor_name = driver.driverName;
  770. const std::vector extensions = physical.EnumerateDeviceExtensionProperties();
  771. reported_extensions.reserve(std::size(extensions));
  772. for (const auto& extension : extensions) {
  773. reported_extensions.emplace_back(extension.extensionName);
  774. }
  775. }
  776. void VKDevice::CollectToolingInfo() {
  777. if (!ext_tooling_info) {
  778. return;
  779. }
  780. const auto vkGetPhysicalDeviceToolPropertiesEXT =
  781. reinterpret_cast<PFN_vkGetPhysicalDeviceToolPropertiesEXT>(
  782. dld.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceToolPropertiesEXT"));
  783. if (!vkGetPhysicalDeviceToolPropertiesEXT) {
  784. return;
  785. }
  786. u32 tool_count = 0;
  787. if (vkGetPhysicalDeviceToolPropertiesEXT(physical, &tool_count, nullptr) != VK_SUCCESS) {
  788. return;
  789. }
  790. std::vector<VkPhysicalDeviceToolPropertiesEXT> tools(tool_count);
  791. if (vkGetPhysicalDeviceToolPropertiesEXT(physical, &tool_count, tools.data()) != VK_SUCCESS) {
  792. return;
  793. }
  794. for (const VkPhysicalDeviceToolPropertiesEXT& tool : tools) {
  795. const std::string_view name = tool.name;
  796. LOG_INFO(Render_Vulkan, "{}", name);
  797. has_renderdoc = has_renderdoc || name == "RenderDoc";
  798. has_nsight_graphics = has_nsight_graphics || name == "NVIDIA Nsight Graphics";
  799. }
  800. }
  801. std::vector<VkDeviceQueueCreateInfo> VKDevice::GetDeviceQueueCreateInfos() const {
  802. static constexpr float QUEUE_PRIORITY = 1.0f;
  803. std::unordered_set<u32> unique_queue_families{graphics_family, present_family};
  804. std::vector<VkDeviceQueueCreateInfo> queue_cis;
  805. queue_cis.reserve(unique_queue_families.size());
  806. for (const u32 queue_family : unique_queue_families) {
  807. auto& ci = queue_cis.emplace_back(VkDeviceQueueCreateInfo{
  808. .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
  809. .pNext = nullptr,
  810. .flags = 0,
  811. .queueFamilyIndex = queue_family,
  812. .queueCount = 1,
  813. .pQueuePriorities = nullptr,
  814. });
  815. ci.pQueuePriorities = &QUEUE_PRIORITY;
  816. }
  817. return queue_cis;
  818. }
  819. } // namespace Vulkan