Fix CPU Core Count detection and Enable Parallel Shader Compilation

This does this following things:

- Default to the runtime automatic number of threads for pre-compiling shaders
- Adds a distinct automatic thread count computation for pre-compilation  (which has less other things going on
and should scale better beyond 4 cores)
- Removes the unused logical_core_count field from the CPU detection
- Changes the semantics of num_cores from maximaum addressable number of cores to actually available CPU cores
(which is also how it was actually used)
- Updates the computation of the HTT flag now that AMD no longer lies about it for its Zen processors
- Background shader compilation is *not* enabled by default
This commit is contained in:
DevJPM
2021-01-02 13:47:18 +01:00
committed by unknown
parent 6ca2897d20
commit 61cfd8696e
4 changed files with 20 additions and 34 deletions

View File

@ -176,6 +176,14 @@ static u32 GetNumAutoShaderCompilerThreads()
return static_cast<u32>(std::min(std::max(cpu_info.num_cores - 3, 1), 4));
}
static u32 GetNumAutoShaderPreCompilerThreads()
{
// Automatic number. We use clamp(cpus - 2, 1, infty) here.
// We chose this because we don't want to limit our speed-up
// and at the same time leave two logical cores for the dolphin UI and the rest of the OS.
return static_cast<u32>(std::max(cpu_info.num_cores - 2, 1));
}
u32 VideoConfig::GetShaderCompilerThreads() const
{
if (!backend_info.bSupportsBackgroundCompiling)
@ -199,5 +207,5 @@ u32 VideoConfig::GetShaderPrecompilerThreads() const
if (iShaderPrecompilerThreads >= 0)
return static_cast<u32>(iShaderPrecompilerThreads);
else
return GetNumAutoShaderCompilerThreads();
return GetNumAutoShaderPreCompilerThreads();
}