diff options
| author | Stenzek <stenzek@gmail.com> | 2017-06-13 20:07:09 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-07-30 17:43:59 +1000 |
| commit | 901bf9c257347c91101ca25e74037684dd519968 (patch) | |
| tree | 221b238d83046c1f6fe15d5778b0526db463c401 /Source/Core/VideoCommon/VideoConfig.cpp | |
| parent | 745d54152747877f2bffbfbd66678f2f4a0f3e80 (diff) | |
VideoConfig: Add config options for ubershaders
Diffstat (limited to 'Source/Core/VideoCommon/VideoConfig.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoConfig.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 355d2486b4..96ec61d596 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -4,6 +4,7 @@ #include <algorithm> +#include "Common/CPUDetect.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" #include "Core/Config/GraphicsSettings.h" @@ -93,6 +94,12 @@ void VideoConfig::Refresh() bBackendMultithreading = Config::Get(Config::GFX_BACKEND_MULTITHREADING); iCommandBufferExecuteInterval = Config::Get(Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL); bShaderCache = Config::Get(Config::GFX_SHADER_CACHE); + bBackgroundShaderCompiling = Config::Get(Config::GFX_BACKGROUND_SHADER_COMPILING); + bDisableSpecializedShaders = Config::Get(Config::GFX_DISABLE_SPECIALIZED_SHADERS); + bPrecompileUberShaders = Config::Get(Config::GFX_PRECOMPILE_UBER_SHADERS); + iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS); + bForceVertexUberShaders = Config::Get(Config::GFX_FORCE_VERTEX_UBER_SHADERS); + bForcePixelUberShaders = Config::Get(Config::GFX_FORCE_PIXEL_UBER_SHADERS); bZComploc = Config::Get(Config::GFX_SW_ZCOMPLOC); bZFreeze = Config::Get(Config::GFX_SW_ZFREEZE); @@ -188,3 +195,31 @@ bool VideoConfig::IsVSync() { return bVSync && !Core::GetIsThrottlerTempDisabled(); } + +u32 VideoConfig::GetShaderCompilerThreads() const +{ + if (iShaderCompilerThreads >= 0) + return static_cast<u32>(iShaderCompilerThreads); + + // Automatic number. We use clamp(cpus - 3, 1, 4). + return static_cast<u32>(std::min(std::max(cpu_info.num_cores - 3, 1), 4)); +} + +bool VideoConfig::CanUseUberShaders() const +{ + // Ubershaders are currently incompatible with per-pixel lighting. + return !bEnablePixelLighting; +} + +bool VideoConfig::CanPrecompileUberShaders() const +{ + // We don't want to precompile ubershaders if they're never going to be used. + return bPrecompileUberShaders && (bBackgroundShaderCompiling || bDisableSpecializedShaders) && + CanUseUberShaders(); +} + +bool VideoConfig::CanBackgroundCompileShaders() const +{ + // We require precompiled ubershaders to background compile shaders. + return bBackgroundShaderCompiling && bPrecompileUberShaders && CanUseUberShaders(); +} |
