mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
VideoConfig: Add config options for ubershaders
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user