From f41c238c53e84362b80361e366495a0ba8ddd3b6 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 10 Jun 2024 17:44:06 +1000 Subject: [PATCH] VulkanDevice: Disable VK_KHR_dynamic_rendering_local_read on AMD Like everything else on RDNA3, it appears to be broken and causes GPU hangs/resets. --- src/util/vulkan_device.cpp | 46 +++++++++++++++++++++++++------------- src/util/vulkan_device.h | 3 +++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/util/vulkan_device.cpp b/src/util/vulkan_device.cpp index 3ceffb2e0..d6dfeb641 100644 --- a/src/util/vulkan_device.cpp +++ b/src/util/vulkan_device.cpp @@ -417,6 +417,31 @@ bool VulkanDevice::SelectDeviceExtensions(ExtensionList* extension_list, bool en m_optional_extensions.vk_ext_full_screen_exclusive ? "supported" : "NOT supported"); #endif + if (IsBrokenMobileDriver()) + { + // Push descriptor is broken on Adreno v502.. don't want to think about dynamic rendending. + if (m_optional_extensions.vk_khr_dynamic_rendering) + { + m_optional_extensions.vk_khr_dynamic_rendering = false; + m_optional_extensions.vk_khr_dynamic_rendering_local_read = false; + WARNING_LOG("Disabling VK_KHR_dynamic_rendering on broken mobile driver."); + } + if (m_optional_extensions.vk_khr_push_descriptor) + { + m_optional_extensions.vk_khr_push_descriptor = false; + WARNING_LOG("Disabling VK_KHR_push_descriptor on broken mobile driver."); + } + } + else if (IsDeviceAMD()) + { + // VK_KHR_dynamic_rendering_local_read appears to be broken on RDNA3, like everything else... + // Just causes GPU resets when you actually use a feedback loop. Assume Mesa is fine. +#if defined(_WIN32) || defined(__ANDROID__) + m_optional_extensions.vk_khr_dynamic_rendering_local_read = false; + WARNING_LOG("Disabling VK_KHR_dynamic_rendering_local_read on broken AMD driver."); +#endif + } + return true; } @@ -675,22 +700,6 @@ void VulkanDevice::ProcessDeviceExtensions() m_optional_extensions.vk_ext_external_memory_host &= (external_memory_host_properties.minImportedHostPointerAlignment == HOST_PAGE_SIZE); - if (IsBrokenMobileDriver()) - { - // Push descriptor is broken on Adreno v502.. don't want to think about dynamic rendending. - if (m_optional_extensions.vk_khr_dynamic_rendering) - { - m_optional_extensions.vk_khr_dynamic_rendering = false; - m_optional_extensions.vk_khr_dynamic_rendering_local_read = false; - WARNING_LOG("Disabling VK_KHR_dynamic_rendering on broken mobile driver."); - } - if (m_optional_extensions.vk_khr_push_descriptor) - { - m_optional_extensions.vk_khr_push_descriptor = false; - WARNING_LOG("Disabling VK_KHR_push_descriptor on broken mobile driver."); - } - } - INFO_LOG("VK_EXT_memory_budget is {}", m_optional_extensions.vk_ext_memory_budget ? "supported" : "NOT supported"); INFO_LOG("VK_EXT_rasterization_order_attachment_access is {}", m_optional_extensions.vk_ext_rasterization_order_attachment_access ? "supported" : "NOT supported"); @@ -1648,6 +1657,11 @@ bool VulkanDevice::IsDeviceNVIDIA() const return (m_device_properties.vendorID == 0x10DE); } +bool VulkanDevice::IsDeviceAMD() const +{ + return (m_device_properties.vendorID == 0x1002); +} + bool VulkanDevice::IsDeviceAdreno() const { // Assume turnip is fine... diff --git a/src/util/vulkan_device.h b/src/util/vulkan_device.h index 14e821ab8..a50461357 100644 --- a/src/util/vulkan_device.h +++ b/src/util/vulkan_device.h @@ -305,6 +305,9 @@ private: /// Returns true if running on an NVIDIA GPU. bool IsDeviceNVIDIA() const; + /// Returns true if running on an AMD GPU. + bool IsDeviceAMD() const; + // Vendor queries. bool IsDeviceAdreno() const; bool IsDeviceMali() const;