summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorDevJPM <jean-pierre.muench@web.de>2021-06-03 16:03:37 +0200
committerunknown <jean-pierre.muench@posteo.de>2021-11-22 09:34:28 +0100
commit613c4563c288b5b73b2f1defb23ad645cef97bee (patch)
tree6883b1fe1d2b7479cdc3c9a0a9bdd4a004385ef5 /Source/Core
parent61cfd8696ee010758c48d02eac13d3dffc3501a7 (diff)
VideoCommon: Gate Multi-Threaded Shader Pre-Compilation behind a bug entry
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/DriverDetails.cpp15
-rw-r--r--Source/Core/VideoCommon/DriverDetails.h8
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp12
3 files changed, 34 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index 6029654e57..7f1d188ff8 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -131,6 +131,21 @@ constexpr BugInfo m_known_bugs[] = {
-1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_SUBGROUP_INVOCATION_ID, -1.0, -1.0, true},
+ // Default cases for broken MT precompilation
+ // Default cases get replaced by known-good places during init
+ {API_OPENGL, OS_ALL, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, true},
+ {API_VULKAN, OS_ALL, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, true},
+ // known good cases for broken MT precompilation
+ {API_OPENGL, OS_OSX, VENDOR_NVIDIA, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, false},
+ {API_VULKAN, OS_OSX, VENDOR_NVIDIA, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, false},
+ {API_OPENGL, OS_WINDOWS, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, false},
+ {API_VULKAN, OS_WINDOWS, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION, -1.0, -1.0, false},
};
static std::map<Bug, BugInfo> m_bugs;
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index 5e3f2ce161..a81ed3d6ff 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -314,6 +314,14 @@ enum Bug
// Started version: -1
// Ended version: -1
BUG_BROKEN_SUBGROUP_INVOCATION_ID,
+
+ // BUG: Multi-threaded shader pre-compilation sometimes crashes
+ // Used primarily in Videoconfig.cpp's GetNumAutoShaderPreCompilerThreads()
+ // refer to https://github.com/dolphin-emu/dolphin/pull/9414 for initial validation coverage
+ // All untested platforms will report as having this bug as to avoid crashes
+ // Note that things should highly likely work out fine on D3D
+ // so we didn't extend the Bug API to also support D3D
+ BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION
};
// Initializes our internal vendor, device family, and driver version
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 9cdf1256f7..5e833a4244 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -10,6 +10,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/Movie.h"
+#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
@@ -204,8 +205,17 @@ u32 VideoConfig::GetShaderPrecompilerThreads() const
if (!backend_info.bSupportsBackgroundCompiling)
return 0;
+ const bool bugDatabaseSupported =
+ backend_info.api_type == APIType::OpenGL || backend_info.api_type == APIType::Vulkan;
+ // DirectX has always worked in our tests in PR#9414
+ const bool multiThreadingWorking =
+ !bugDatabaseSupported ||
+ !DriverDetails::HasBug(DriverDetails::BUG_BROKEN_MULTITHREADED_SHADER_PRECOMPILATION);
+
if (iShaderPrecompilerThreads >= 0)
return static_cast<u32>(iShaderPrecompilerThreads);
- else
+ else if (multiThreadingWorking)
return GetNumAutoShaderPreCompilerThreads();
+ else
+ return 1;
}