diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 55 |
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 4d8232655..876cec2e8 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 | ||
| 86 | enum class NvidiaArchitecture { | 86 | enum class NvidiaArchitecture { |
| 87 | AmpereOrNewer, | 87 | KeplerOrOlder, |
| 88 | Maxwell, | ||
| 89 | Pascal, | ||
| 90 | Volta, | ||
| 88 | Turing, | 91 | Turing, |
| 89 | VoltaOrOlder, | 92 | AmpereOrNewer, |
| 90 | }; | 93 | }; |
| 91 | 94 | ||
| 92 | template <typename T> | 95 | template <typename T> |
| @@ -322,13 +325,38 @@ NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical, | |||
| 322 | physical.GetProperties2(physical_properties); | 325 | physical.GetProperties2(physical_properties); |
| 323 | if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) { | 326 | if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) { |
| 324 | // Only Ampere and newer support this feature | 327 | // Only Ampere and newer support this feature |
| 328 | // TODO: Find a way to differentiate Ampere and Ada | ||
| 325 | return NvidiaArchitecture::AmpereOrNewer; | 329 | return NvidiaArchitecture::AmpereOrNewer; |
| 326 | } | 330 | } |
| 327 | } | ||
| 328 | if (exts.contains(VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME)) { | ||
| 329 | return NvidiaArchitecture::Turing; | 331 | return NvidiaArchitecture::Turing; |
| 330 | } | 332 | } |
| 331 | return NvidiaArchitecture::VoltaOrOlder; | 333 | |
| 334 | if (exts.contains(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME)) { | ||
| 335 | VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT advanced_blending_props{}; | ||
| 336 | advanced_blending_props.sType = | ||
| 337 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT; | ||
| 338 | VkPhysicalDeviceProperties2 physical_properties{}; | ||
| 339 | physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; | ||
| 340 | physical_properties.pNext = &advanced_blending_props; | ||
| 341 | physical.GetProperties2(physical_properties); | ||
| 342 | if (advanced_blending_props.advancedBlendMaxColorAttachments == 1) { | ||
| 343 | return NvidiaArchitecture::Maxwell; | ||
| 344 | } | ||
| 345 | |||
| 346 | if (exts.contains(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) { | ||
| 347 | VkPhysicalDeviceConservativeRasterizationPropertiesEXT conservative_raster_props{}; | ||
| 348 | conservative_raster_props.sType = | ||
| 349 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT; | ||
| 350 | physical_properties.pNext = &conservative_raster_props; | ||
| 351 | physical.GetProperties2(physical_properties); | ||
| 352 | if (conservative_raster_props.degenerateLinesRasterized) { | ||
| 353 | return NvidiaArchitecture::Volta; | ||
| 354 | } | ||
| 355 | return NvidiaArchitecture::Pascal; | ||
| 356 | } | ||
| 357 | } | ||
| 358 | |||
| 359 | return NvidiaArchitecture::KeplerOrOlder; | ||
| 332 | } | 360 | } |
| 333 | 361 | ||
| 334 | std::vector<const char*> ExtensionListForVulkan( | 362 | std::vector<const char*> ExtensionListForVulkan( |
| @@ -505,19 +533,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 505 | if (is_nvidia) { | 533 | if (is_nvidia) { |
| 506 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; | 534 | const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff; |
| 507 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); | 535 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); |
| 508 | switch (arch) { | 536 | if (arch >= NvidiaArchitecture::AmpereOrNewer) { |
| 509 | case NvidiaArchitecture::AmpereOrNewer: | ||
| 510 | LOG_WARNING(Render_Vulkan, "Ampere and newer have broken float16 math"); | 537 | LOG_WARNING(Render_Vulkan, "Ampere and newer have broken float16 math"); |
| 511 | features.shader_float16_int8.shaderFloat16 = false; | 538 | features.shader_float16_int8.shaderFloat16 = false; |
| 512 | break; | 539 | } else if (arch <= NvidiaArchitecture::Volta) { |
| 513 | case NvidiaArchitecture::Turing: | ||
| 514 | break; | ||
| 515 | case NvidiaArchitecture::VoltaOrOlder: | ||
| 516 | if (nv_major_version < 527) { | 540 | if (nv_major_version < 527) { |
| 517 | LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor"); | 541 | LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor"); |
| 518 | RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); | 542 | RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); |
| 519 | } | 543 | } |
| 520 | break; | ||
| 521 | } | 544 | } |
| 522 | if (nv_major_version >= 510) { | 545 | if (nv_major_version >= 510) { |
| 523 | LOG_WARNING(Render_Vulkan, "NVIDIA Drivers >= 510 do not support MSAA image blits"); | 546 | LOG_WARNING(Render_Vulkan, "NVIDIA Drivers >= 510 do not support MSAA image blits"); |
| @@ -662,7 +685,15 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR | |||
| 662 | "ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor"); | 685 | "ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor"); |
| 663 | RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); | 686 | RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); |
| 664 | } | 687 | } |
| 688 | } else if (extensions.push_descriptor && is_nvidia) { | ||
| 689 | const auto arch = GetNvidiaArchitecture(physical, supported_extensions); | ||
| 690 | if (arch <= NvidiaArchitecture::Pascal) { | ||
| 691 | LOG_WARNING(Render_Vulkan, | ||
| 692 | "Pascal and older architectures have broken VK_KHR_push_descriptor"); | ||
| 693 | RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); | ||
| 694 | } | ||
| 665 | } | 695 | } |
| 696 | |||
| 666 | if (is_mvk) { | 697 | if (is_mvk) { |
| 667 | LOG_WARNING(Render_Vulkan, | 698 | LOG_WARNING(Render_Vulkan, |
| 668 | "MVK driver breaks when using more than 16 vertex attributes/bindings"); | 699 | "MVK driver breaks when using more than 16 vertex attributes/bindings"); |