summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2023-10-07 10:54:52 -0400
committerGravatar GitHub2023-10-07 10:54:52 -0400
commit10de8f2c60813ce79dd83e795f08fc8b62c6ffab (patch)
tree04439ab0720b6ee800d4e4f3ce82fe1f8bc057a9 /src
parentMerge pull request #11657 from liamwhite/new-codespell (diff)
parentRework nvidia architecture detection, disable push descriptor for Pascal and ... (diff)
downloadyuzu-10de8f2c60813ce79dd83e795f08fc8b62c6ffab.tar.gz
yuzu-10de8f2c60813ce79dd83e795f08fc8b62c6ffab.tar.xz
yuzu-10de8f2c60813ce79dd83e795f08fc8b62c6ffab.zip
Merge pull request #11684 from Kelebek1/disable_push_descriptor_maxwell
Disable push descriptor for Pascal and older nVidia architectures
Diffstat (limited to 'src')
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 3960b135a..e7ce28dd4 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -84,9 +84,12 @@ constexpr std::array VK_FORMAT_A4B4G4R4_UNORM_PACK16{
84} // namespace Alternatives 84} // namespace Alternatives
85 85
86enum class NvidiaArchitecture { 86enum class NvidiaArchitecture {
87 AmpereOrNewer, 87 KeplerOrOlder,
88 Maxwell,
89 Pascal,
90 Volta,
88 Turing, 91 Turing,
89 VoltaOrOlder, 92 AmpereOrNewer,
90}; 93};
91 94
92template <typename T> 95template <typename T>
@@ -321,13 +324,38 @@ NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical,
321 physical.GetProperties2(physical_properties); 324 physical.GetProperties2(physical_properties);
322 if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) { 325 if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) {
323 // Only Ampere and newer support this feature 326 // Only Ampere and newer support this feature
327 // TODO: Find a way to differentiate Ampere and Ada
324 return NvidiaArchitecture::AmpereOrNewer; 328 return NvidiaArchitecture::AmpereOrNewer;
325 } 329 }
326 }
327 if (exts.contains(VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME)) {
328 return NvidiaArchitecture::Turing; 330 return NvidiaArchitecture::Turing;
329 } 331 }
330 return NvidiaArchitecture::VoltaOrOlder; 332
333 if (exts.contains(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME)) {
334 VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT advanced_blending_props{};
335 advanced_blending_props.sType =
336 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT;
337 VkPhysicalDeviceProperties2 physical_properties{};
338 physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
339 physical_properties.pNext = &advanced_blending_props;
340 physical.GetProperties2(physical_properties);
341 if (advanced_blending_props.advancedBlendMaxColorAttachments == 1) {
342 return NvidiaArchitecture::Maxwell;
343 }
344
345 if (exts.contains(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) {
346 VkPhysicalDeviceConservativeRasterizationPropertiesEXT conservative_raster_props{};
347 conservative_raster_props.sType =
348 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT;
349 physical_properties.pNext = &conservative_raster_props;
350 physical.GetProperties2(physical_properties);
351 if (conservative_raster_props.degenerateLinesRasterized) {
352 return NvidiaArchitecture::Volta;
353 }
354 return NvidiaArchitecture::Pascal;
355 }
356 }
357
358 return NvidiaArchitecture::KeplerOrOlder;
331} 359}
332 360
333std::vector<const char*> ExtensionListForVulkan( 361std::vector<const char*> ExtensionListForVulkan(
@@ -504,19 +532,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
504 if (is_nvidia) { 532 if (is_nvidia) {
505 const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; 533 const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;
506 const auto arch = GetNvidiaArchitecture(physical, supported_extensions); 534 const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
507 switch (arch) { 535 if (arch >= NvidiaArchitecture::AmpereOrNewer) {
508 case NvidiaArchitecture::AmpereOrNewer:
509 LOG_WARNING(Render_Vulkan, "Ampere and newer have broken float16 math"); 536 LOG_WARNING(Render_Vulkan, "Ampere and newer have broken float16 math");
510 features.shader_float16_int8.shaderFloat16 = false; 537 features.shader_float16_int8.shaderFloat16 = false;
511 break; 538 } else if (arch <= NvidiaArchitecture::Volta) {
512 case NvidiaArchitecture::Turing:
513 break;
514 case NvidiaArchitecture::VoltaOrOlder:
515 if (nv_major_version < 527) { 539 if (nv_major_version < 527) {
516 LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor"); 540 LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor");
517 RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); 541 RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
518 } 542 }
519 break;
520 } 543 }
521 if (nv_major_version >= 510) { 544 if (nv_major_version >= 510) {
522 LOG_WARNING(Render_Vulkan, "NVIDIA Drivers >= 510 do not support MSAA image blits"); 545 LOG_WARNING(Render_Vulkan, "NVIDIA Drivers >= 510 do not support MSAA image blits");
@@ -661,7 +684,15 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
661 "ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor"); 684 "ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor");
662 RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); 685 RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
663 } 686 }
687 } else if (extensions.push_descriptor && is_nvidia) {
688 const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
689 if (arch <= NvidiaArchitecture::Pascal) {
690 LOG_WARNING(Render_Vulkan,
691 "Pascal and older architectures have broken VK_KHR_push_descriptor");
692 RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
693 }
664 } 694 }
695
665 if (is_mvk) { 696 if (is_mvk) {
666 LOG_WARNING(Render_Vulkan, 697 LOG_WARNING(Render_Vulkan,
667 "MVK driver breaks when using more than 16 vertex attributes/bindings"); 698 "MVK driver breaks when using more than 16 vertex attributes/bindings");