From 8df956b03639acbaf0e14b483295cdb7c23cac05 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 2 Oct 2022 07:32:31 -0700 Subject: [PATCH] Vulkan: Block geometry shaders on older Mali. They're too slow to be usable. --- Common/GPU/Vulkan/thin3d_vulkan.cpp | 5 +++++ Common/GPU/thin3d.h | 3 +++ GPU/Vulkan/GPU_Vulkan.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 413057b288..06e026d35c 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -846,6 +846,11 @@ VKContext::VKContext(VulkanContext *vulkan) if (majorVersion >= 32) { bugs_.Infest(Bugs::MALI_CONSTANT_LOAD_BUG); // See issue #15661 } + + // Older ARM devices have very slow geometry shaders, not worth using. At least before 15. + if (majorVersion <= 15) { + bugs_.Infest(Bugs::GEOMETRY_SHADERS_SLOW); + } } // Limited, through input attachments and self-dependencies. diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index f0c562b2f3..c04b7119cd 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -333,11 +333,14 @@ public: RASPBERRY_SHADER_COMP_HANG = 8, MALI_CONSTANT_LOAD_BUG = 9, SUBPASS_FEEDBACK_BROKEN = 10, + GEOMETRY_SHADERS_SLOW = 11, MAX_BUG, }; protected: uint32_t flags_ = 0; + + static_assert(sizeof(flags_) * 8 > MAX_BUG, "Ran out of space for bugs."); }; class RefCountedObject { diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 6376fc0620..6d91a3b20e 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -233,7 +233,7 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { } // Fall back to geometry shader culling if we can't do vertex range culling. - if (enabledFeatures.geometryShader) { + if (enabledFeatures.geometryShader && !draw_->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW)) { const bool vertexSupported = draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported; if (!vertexSupported || (features & GPU_SUPPORTS_VS_RANGE_CULLING) == 0) { // Switch to culling via the geometry shader if not fully supported in vertex.