From 2cca0b265ecac44a6287df9ed8b9d214299b5e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 3 May 2023 11:53:32 +0200 Subject: [PATCH] Vulkan: Turn off the ubershader on T880, T860 and T830 on old driver versions. --- Common/GPU/Vulkan/thin3d_vulkan.cpp | 14 +++++++++++++- Common/GPU/thin3d.h | 1 + GPU/Vulkan/GPU_Vulkan.cpp | 9 ++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 648a21875e..8eb6c4e2bd 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -948,6 +948,9 @@ VKContext::VKContext(VulkanContext *vulkan) // Workaround for Intel driver bug. TODO: Re-enable after some driver version bugs_.Infest(Bugs::DUAL_SOURCE_BLENDING_BROKEN); } else if (caps_.vendor == GPUVendor::VENDOR_ARM) { + // Really old Vulkan drivers for Mali didn't have proper versions. We try to detect that (can't be 100% but pretty good). + bool isOldVersion = IsHashMaliDriverVersion(deviceProps); + int majorVersion = VK_API_VERSION_MAJOR(deviceProps.driverVersion); // These GPUs (up to some certain hardware version?) have a bug where draws where gl_Position.w == .z @@ -966,9 +969,18 @@ VKContext::VKContext(VulkanContext *vulkan) // Older ARM devices have very slow geometry shaders, not worth using. At least before 15. // Also seen to cause weird issues on 18, so let's lump it in. - if (majorVersion <= 18) { + if (majorVersion <= 18 || isOldVersion) { bugs_.Infest(Bugs::GEOMETRY_SHADERS_SLOW_OR_BROKEN); } + + // Attempt to workaround #17386 + if (isOldVersion) { + if (!strcmp(deviceProps.deviceName, "Mali-T880") || + !strcmp(deviceProps.deviceName, "Mali-T860") || + !strcmp(deviceProps.deviceName, "Mali-T830")) { + bugs_.Infest(Bugs::UNIFORM_INDEXING_BROKEN); + } + } } // Limited, through input attachments and self-dependencies. diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index 5ccb236b07..26f63c9800 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -347,6 +347,7 @@ public: SUBPASS_FEEDBACK_BROKEN = 10, GEOMETRY_SHADERS_SLOW_OR_BROKEN = 11, ADRENO_RESOURCE_DEADLOCK = 12, + UNIFORM_INDEXING_BROKEN = 13, // not a properly diagnosed issue, a workaround attempt: #17386 MAX_BUG, }; diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index ee68954fd3..9c0f1b2a06 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -199,7 +199,7 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { uint32_t features = GPUCommonHW::CheckGPUFeatures(); VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT); - + // Could simplify this, but it's good as documentation. switch (vulkan->GetPhysicalDeviceProperties().properties.vendorID) { case VULKAN_VENDOR_AMD: @@ -216,6 +216,8 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { // NOTE: Galaxy S8 has version 16 but still seems to have some problems with accurate depth. + // TODO: Move this check to thin3d_vulkan. + bool driverTooOld = IsHashMaliDriverVersion(vulkan->GetPhysicalDeviceProperties().properties) || VK_VERSION_MAJOR(vulkan->GetPhysicalDeviceProperties().properties.driverVersion) < 14; @@ -293,6 +295,11 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { features &= ~GPU_USE_FRAMEBUFFER_FETCH; // } + // Attempt to workaround #17386 + if (draw_->GetBugs().Has(Draw::Bugs::UNIFORM_INDEXING_BROKEN)) { + features &= ~GPU_USE_LIGHT_UBERSHADER; + } + return CheckGPUFeaturesLate(features); }