diff options
| author | Stenzek <stenzek@gmail.com> | 2017-07-27 13:15:38 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-07-30 17:43:59 +1000 |
| commit | c8f31656cb1c5f5e3c83a5b977fd822e987cb596 (patch) | |
| tree | 533941c3211604f5550bffb9b56930c141efd6ae /Source/Core/VideoCommon/VideoConfig.cpp | |
| parent | e17efb1d8dcff32e7db915a53dc95df0bf329692 (diff) | |
VideoBackends: Support a different number of threads for precompiling
At runtime, we only really want a single shader compiler thread.
However, for initial boots, we can use a higher number to speed things
up.
Diffstat (limited to 'Source/Core/VideoCommon/VideoConfig.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 96ec61d596..2b0b169649 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -98,6 +98,7 @@ void VideoConfig::Refresh() bDisableSpecializedShaders = Config::Get(Config::GFX_DISABLE_SPECIALIZED_SHADERS); bPrecompileUberShaders = Config::Get(Config::GFX_PRECOMPILE_UBER_SHADERS); iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS); + iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS); bForceVertexUberShaders = Config::Get(Config::GFX_FORCE_VERTEX_UBER_SHADERS); bForcePixelUberShaders = Config::Get(Config::GFX_FORCE_PIXEL_UBER_SHADERS); @@ -196,13 +197,26 @@ bool VideoConfig::IsVSync() return bVSync && !Core::GetIsThrottlerTempDisabled(); } +static u32 GetNumAutoShaderCompilerThreads() +{ + // Automatic number. We use clamp(cpus - 3, 1, 4). + return static_cast<u32>(std::min(std::max(cpu_info.num_cores - 3, 1), 4)); +} + u32 VideoConfig::GetShaderCompilerThreads() const { if (iShaderCompilerThreads >= 0) return static_cast<u32>(iShaderCompilerThreads); + else + return GetNumAutoShaderCompilerThreads(); +} - // Automatic number. We use clamp(cpus - 3, 1, 4). - return static_cast<u32>(std::min(std::max(cpu_info.num_cores - 3, 1), 4)); +u32 VideoConfig::GetShaderPrecompilerThreads() const +{ + if (iShaderPrecompilerThreads >= 0) + return static_cast<u32>(iShaderPrecompilerThreads); + else + return GetNumAutoShaderCompilerThreads(); } bool VideoConfig::CanUseUberShaders() const |
