VideoConfig: Collapse ubershader configuration fields to a single value
This commit is contained in:
parent
590307b94c
commit
9fa24700b6
|
@ -180,13 +180,16 @@ void DolphinAnalytics::MakeBaseBuilder()
|
|||
|
||||
static const char* GetUbershaderMode(const VideoConfig& video_config)
|
||||
{
|
||||
if (video_config.bDisableSpecializedShaders)
|
||||
switch (video_config.iUberShaderMode)
|
||||
{
|
||||
case UberShaderMode::Exclusive:
|
||||
return "exclusive";
|
||||
|
||||
if (video_config.bBackgroundShaderCompiling)
|
||||
case UberShaderMode::Hybrid:
|
||||
return "hybrid";
|
||||
|
||||
return "disabled";
|
||||
case UberShaderMode::Disabled:
|
||||
default:
|
||||
return "disabled";
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinAnalytics::MakePerGameBuilder()
|
||||
|
|
|
@ -76,12 +76,8 @@ const ConfigInfo<bool> GFX_BACKEND_MULTITHREADING{
|
|||
const ConfigInfo<int> GFX_COMMAND_BUFFER_EXECUTE_INTERVAL{
|
||||
{System::GFX, "Settings", "CommandBufferExecuteInterval"}, 100};
|
||||
const ConfigInfo<bool> GFX_SHADER_CACHE{{System::GFX, "Settings", "ShaderCache"}, true};
|
||||
const ConfigInfo<bool> GFX_BACKGROUND_SHADER_COMPILING{
|
||||
{System::GFX, "Settings", "BackgroundShaderCompiling"}, false};
|
||||
const ConfigInfo<bool> GFX_DISABLE_SPECIALIZED_SHADERS{
|
||||
{System::GFX, "Settings", "DisableSpecializedShaders"}, false};
|
||||
const ConfigInfo<bool> GFX_PRECOMPILE_UBER_SHADERS{
|
||||
{System::GFX, "Settings", "PrecompileUberShaders"}, true};
|
||||
const ConfigInfo<int> GFX_UBERSHADER_MODE{{System::GFX, "Settings", "UberShaderMode"},
|
||||
static_cast<int>(UberShaderMode::Disabled)};
|
||||
const ConfigInfo<int> GFX_SHADER_COMPILER_THREADS{
|
||||
{System::GFX, "Settings", "ShaderCompilerThreads"}, 1};
|
||||
const ConfigInfo<int> GFX_SHADER_PRECOMPILER_THREADS{
|
||||
|
|
|
@ -59,9 +59,7 @@ extern const ConfigInfo<bool> GFX_ENABLE_VALIDATION_LAYER;
|
|||
extern const ConfigInfo<bool> GFX_BACKEND_MULTITHREADING;
|
||||
extern const ConfigInfo<int> GFX_COMMAND_BUFFER_EXECUTE_INTERVAL;
|
||||
extern const ConfigInfo<bool> GFX_SHADER_CACHE;
|
||||
extern const ConfigInfo<bool> GFX_BACKGROUND_SHADER_COMPILING;
|
||||
extern const ConfigInfo<bool> GFX_DISABLE_SPECIALIZED_SHADERS;
|
||||
extern const ConfigInfo<bool> GFX_PRECOMPILE_UBER_SHADERS;
|
||||
extern const ConfigInfo<int> GFX_UBERSHADER_MODE;
|
||||
extern const ConfigInfo<int> GFX_SHADER_COMPILER_THREADS;
|
||||
extern const ConfigInfo<int> GFX_SHADER_PRECOMPILER_THREADS;
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)
|
|||
Config::GFX_DISABLE_FOG.location, Config::GFX_BORDERLESS_FULLSCREEN.location,
|
||||
Config::GFX_ENABLE_VALIDATION_LAYER.location, Config::GFX_BACKEND_MULTITHREADING.location,
|
||||
Config::GFX_COMMAND_BUFFER_EXECUTE_INTERVAL.location, Config::GFX_SHADER_CACHE.location,
|
||||
Config::GFX_BACKGROUND_SHADER_COMPILING.location,
|
||||
Config::GFX_DISABLE_SPECIALIZED_SHADERS.location,
|
||||
Config::GFX_PRECOMPILE_UBER_SHADERS.location, Config::GFX_SHADER_COMPILER_THREADS.location,
|
||||
Config::GFX_UBERSHADER_MODE.location, Config::GFX_SHADER_COMPILER_THREADS.location,
|
||||
Config::GFX_SHADER_PRECOMPILER_THREADS.location,
|
||||
|
||||
Config::GFX_SW_ZCOMPLOC.location, Config::GFX_SW_ZFREEZE.location,
|
||||
|
|
|
@ -63,9 +63,8 @@ void EnhancementsWidget::CreateWidgets()
|
|||
m_af_combo = new GraphicsChoice({tr("1x"), tr("2x"), tr("4x"), tr("8x"), tr("16x")},
|
||||
Config::GFX_ENHANCE_MAX_ANISOTROPY);
|
||||
|
||||
m_ubershader_combo = new QComboBox;
|
||||
for (const auto& option : {tr("Disabled"), tr("Hybrid"), tr("Exclusive")})
|
||||
m_ubershader_combo->addItem(option);
|
||||
m_ubershader_combo = new GraphicsChoice({tr("Disabled"), tr("Hybrid"), tr("Exclusive")},
|
||||
Config::GFX_UBERSHADER_MODE);
|
||||
|
||||
m_pp_effect = new QComboBox();
|
||||
m_configure_pp_effect = new QPushButton(tr("Configure"));
|
||||
|
@ -131,9 +130,6 @@ void EnhancementsWidget::ConnectWidgets()
|
|||
{
|
||||
connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[this](int) { SaveSettings(); });
|
||||
connect(m_ubershader_combo,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[this](int) { SaveSettings(); });
|
||||
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
[this](int) { SaveSettings(); });
|
||||
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
|
@ -156,13 +152,6 @@ void EnhancementsWidget::LoadSettings()
|
|||
QString::fromStdString(std::to_string(aa_selection) + "x " + (ssaa ? "SSAA" : "MSAA")));
|
||||
m_aa_combo->setEnabled(m_aa_combo->count() > 1);
|
||||
|
||||
if (Config::GetBase(Config::GFX_DISABLE_SPECIALIZED_SHADERS))
|
||||
m_ubershader_combo->setCurrentIndex(2);
|
||||
else if (Config::GetBase(Config::GFX_BACKGROUND_SHADER_COMPILING))
|
||||
m_ubershader_combo->setCurrentIndex(1);
|
||||
else
|
||||
m_ubershader_combo->setCurrentIndex(0);
|
||||
|
||||
// Post Processing Shader
|
||||
std::vector<std::string> shaders =
|
||||
g_Config.stereo_mode == StereoMode::Anaglyph ?
|
||||
|
@ -220,10 +209,6 @@ void EnhancementsWidget::SaveSettings()
|
|||
|
||||
Config::SetBaseOrCurrent(Config::GFX_SSAA, is_ssaa);
|
||||
|
||||
int us_value = m_ubershader_combo->currentIndex();
|
||||
Config::SetBaseOrCurrent(Config::GFX_BACKGROUND_SHADER_COMPILING, us_value == 1);
|
||||
Config::SetBaseOrCurrent(Config::GFX_DISABLE_SPECIALIZED_SHADERS, us_value == 2);
|
||||
|
||||
Config::SetBaseOrCurrent(Config::GFX_ENHANCE_POST_SHADER,
|
||||
m_pp_effect->currentText().toStdString());
|
||||
|
||||
|
|
|
@ -534,24 +534,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
|
|||
// ubershaders
|
||||
{
|
||||
const std::array<wxString, 3> mode_choices = {{_("Disabled"), _("Hybrid"), _("Exclusive")}};
|
||||
|
||||
wxChoice* const choice_mode =
|
||||
new wxChoice(page_enh, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
static_cast<int>(mode_choices.size()), mode_choices.data());
|
||||
RegisterControl(choice_mode, wxGetTranslation(ubershader_desc));
|
||||
szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Ubershaders:")), wxGBPosition(row, 0),
|
||||
wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
|
||||
szr_enh->Add(choice_mode, wxGBPosition(row, 1), span2, wxALIGN_CENTER_VERTICAL);
|
||||
szr_enh->Add(CreateChoice(page_enh, Config::GFX_UBERSHADER_MODE,
|
||||
wxGetTranslation(ubershader_desc), mode_choices.size(),
|
||||
mode_choices.data()),
|
||||
wxGBPosition(row, 1), span2, wxALIGN_CENTER_VERTICAL);
|
||||
row += 1;
|
||||
|
||||
// Determine ubershader mode
|
||||
choice_mode->Bind(wxEVT_CHOICE, &VideoConfigDiag::OnUberShaderModeChanged, this);
|
||||
if (Config::GetBase(Config::GFX_DISABLE_SPECIALIZED_SHADERS))
|
||||
choice_mode->SetSelection(2);
|
||||
else if (Config::GetBase(Config::GFX_BACKGROUND_SHADER_COMPILING))
|
||||
choice_mode->SetSelection(1);
|
||||
else
|
||||
choice_mode->SetSelection(0);
|
||||
}
|
||||
|
||||
// postproc shader
|
||||
|
@ -1290,13 +1279,3 @@ void VideoConfigDiag::OnAAChanged(wxCommandEvent& ev)
|
|||
|
||||
Config::SetBaseOrCurrent(Config::GFX_MSAA, vconfig.backend_info.AAModes[mode]);
|
||||
}
|
||||
|
||||
void VideoConfigDiag::OnUberShaderModeChanged(wxCommandEvent& ev)
|
||||
{
|
||||
// 0: No ubershaders
|
||||
// 1: Hybrid ubershaders
|
||||
// 2: Only ubershaders
|
||||
int mode = ev.GetInt();
|
||||
Config::SetBaseOrCurrent(Config::GFX_BACKGROUND_SHADER_COMPILING, mode == 1);
|
||||
Config::SetBaseOrCurrent(Config::GFX_DISABLE_SPECIALIZED_SHADERS, mode == 2);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,6 @@ protected:
|
|||
void PopulatePostProcessingShaders();
|
||||
void PopulateAAList();
|
||||
void OnAAChanged(wxCommandEvent& ev);
|
||||
void OnUberShaderModeChanged(wxCommandEvent& ev);
|
||||
|
||||
wxChoice* choice_backend;
|
||||
wxChoice* choice_adapter;
|
||||
|
|
|
@ -38,7 +38,7 @@ bool ShaderCache::Initialize()
|
|||
}
|
||||
|
||||
// Queue ubershader precompiling if required.
|
||||
if (g_ActiveConfig.CanPrecompileUberShaders())
|
||||
if (g_ActiveConfig.UsingUberShaders())
|
||||
PrecompileUberShaders();
|
||||
|
||||
// Compile all known UIDs.
|
||||
|
|
|
@ -566,27 +566,24 @@ void VertexManagerBase::UpdatePipelineObject()
|
|||
m_current_pipeline_object = nullptr;
|
||||
m_pipeline_config_changed = false;
|
||||
|
||||
// Try for specialized shaders.
|
||||
if (!g_ActiveConfig.bDisableSpecializedShaders)
|
||||
if (g_ActiveConfig.iUberShaderMode == UberShaderMode::Disabled)
|
||||
{
|
||||
// Ubershaders disabled? Block and compile the specialized shader.
|
||||
m_current_pipeline_object = g_shader_cache->GetPipelineForUid(m_current_pipeline_config);
|
||||
return;
|
||||
}
|
||||
else if (g_ActiveConfig.iUberShaderMode == UberShaderMode::Hybrid)
|
||||
{
|
||||
// Can we background compile shaders? If so, get the pipeline asynchronously.
|
||||
if (g_ActiveConfig.bBackgroundShaderCompiling)
|
||||
auto res = g_shader_cache->GetPipelineForUidAsync(m_current_pipeline_config);
|
||||
if (res)
|
||||
{
|
||||
auto res = g_shader_cache->GetPipelineForUidAsync(m_current_pipeline_config);
|
||||
if (res)
|
||||
{
|
||||
// Specialized shaders are ready.
|
||||
m_current_pipeline_object = *res;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current_pipeline_object = g_shader_cache->GetPipelineForUid(m_current_pipeline_config);
|
||||
// Specialized shaders are ready, prefer these.
|
||||
m_current_pipeline_object = *res;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to ubershaders.
|
||||
// Exclusive ubershader mode, or hybrid and shaders are still compiling.
|
||||
m_current_pipeline_object = g_shader_cache->GetUberPipelineForUid(m_current_uber_pipeline_config);
|
||||
}
|
||||
|
|
|
@ -102,9 +102,7 @@ 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);
|
||||
iUberShaderMode = static_cast<UberShaderMode>(Config::Get(Config::GFX_UBERSHADER_MODE));
|
||||
iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS);
|
||||
iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS);
|
||||
|
||||
|
@ -206,15 +204,3 @@ u32 VideoConfig::GetShaderPrecompilerThreads() const
|
|||
else
|
||||
return GetNumAutoShaderCompilerThreads();
|
||||
}
|
||||
|
||||
bool VideoConfig::CanPrecompileUberShaders() const
|
||||
{
|
||||
// We don't want to precompile ubershaders if they're never going to be used.
|
||||
return bPrecompileUberShaders && (bBackgroundShaderCompiling || bDisableSpecializedShaders);
|
||||
}
|
||||
|
||||
bool VideoConfig::CanBackgroundCompileShaders() const
|
||||
{
|
||||
// We require precompiled ubershaders to background compile shaders.
|
||||
return bBackgroundShaderCompiling && bPrecompileUberShaders;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,13 @@ enum class StereoMode : int
|
|||
Nvidia3DVision
|
||||
};
|
||||
|
||||
enum class UberShaderMode : int
|
||||
{
|
||||
Disabled,
|
||||
Hybrid,
|
||||
Exclusive
|
||||
};
|
||||
|
||||
struct ProjectionHackConfig final
|
||||
{
|
||||
bool m_enable;
|
||||
|
@ -161,25 +168,8 @@ struct VideoConfig final
|
|||
// Currently only supported with Vulkan.
|
||||
int iCommandBufferExecuteInterval;
|
||||
|
||||
// The following options determine the ubershader mode:
|
||||
// No ubershaders:
|
||||
// - bBackgroundShaderCompiling = false
|
||||
// - bDisableSpecializedShaders = false
|
||||
// Hybrid/background compiling:
|
||||
// - bBackgroundShaderCompiling = true
|
||||
// - bDisableSpecializedShaders = false
|
||||
// Ubershaders only:
|
||||
// - bBackgroundShaderCompiling = false
|
||||
// - bDisableSpecializedShaders = true
|
||||
|
||||
// Enable background shader compiling, use ubershaders while waiting.
|
||||
bool bBackgroundShaderCompiling;
|
||||
|
||||
// Use ubershaders only, don't compile specialized shaders.
|
||||
bool bDisableSpecializedShaders;
|
||||
|
||||
// Precompile ubershader variants at boot/config reload time.
|
||||
bool bPrecompileUberShaders;
|
||||
// Shader compilation settings.
|
||||
UberShaderMode iUberShaderMode;
|
||||
|
||||
// Number of shader compiler threads.
|
||||
// 0 disables background compilation.
|
||||
|
@ -247,10 +237,9 @@ struct VideoConfig final
|
|||
return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding;
|
||||
}
|
||||
bool UseVertexRounding() const { return bVertexRounding && iEFBScale != 1; }
|
||||
bool UsingUberShaders() const { return iUberShaderMode != UberShaderMode::Disabled; }
|
||||
u32 GetShaderCompilerThreads() const;
|
||||
u32 GetShaderPrecompilerThreads() const;
|
||||
bool CanPrecompileUberShaders() const;
|
||||
bool CanBackgroundCompileShaders() const;
|
||||
};
|
||||
|
||||
extern VideoConfig g_Config;
|
||||
|
|
Loading…
Reference in New Issue