VideoCommon: Add config fields for multithreading and validation layers

This commit is contained in:
Stenzek 2016-08-13 22:08:46 +10:00
parent 09638e714e
commit 5346078791
8 changed files with 37 additions and 0 deletions

View File

@ -272,6 +272,12 @@ static wxString stereo_convergence_desc =
static wxString stereo_swap_desc = static wxString stereo_swap_desc =
wxTRANSLATE("Swaps the left and right eye. Mostly useful if you want to view side-by-side " wxTRANSLATE("Swaps the left and right eye. Mostly useful if you want to view side-by-side "
"cross-eyed.\n\nIf unsure, leave this unchecked."); "cross-eyed.\n\nIf unsure, leave this unchecked.");
static wxString validation_layer_desc =
wxTRANSLATE("Enables validation of API calls made by the video backend, which may assist in "
"debugging graphical issues.\n\nIf unsure, leave this unchecked.");
static wxString backend_multithreading_desc =
wxTRANSLATE("Enables multi-threading in the video backend, which may result in performance "
"gains in some scenarios.\n\nIf unsure, leave this unchecked.");
#if !defined(__APPLE__) #if !defined(__APPLE__)
// Search for available resolutions - TODO: Move to Common? // Search for available resolutions - TODO: Move to Common?
@ -471,6 +477,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
CreateCheckBox(page_general, _("Render to Main Window"), CreateCheckBox(page_general, _("Render to Main Window"),
wxGetTranslation(render_to_main_win_desc), wxGetTranslation(render_to_main_win_desc),
SConfig::GetInstance().bRenderToMain)); SConfig::GetInstance().bRenderToMain));
if (vconfig.backend_info.bSupportsMultithreading)
{
szr_other->Add(CreateCheckBox(page_general, _("Enable Multi-threading"),
wxGetTranslation(backend_multithreading_desc),
vconfig.bBackendMultithreading));
}
} }
wxStaticBoxSizer* const group_basic = wxStaticBoxSizer* const group_basic =
@ -760,6 +773,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGetTranslation(show_stats_desc), vconfig.bOverlayStats)); wxGetTranslation(show_stats_desc), vconfig.bOverlayStats));
szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"), szr_debug->Add(CreateCheckBox(page_advanced, _("Texture Format Overlay"),
wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable)); wxGetTranslation(texfmt_desc), vconfig.bTexFmtOverlayEnable));
szr_debug->Add(CreateCheckBox(page_advanced, _("Enable API Validation Layers"),
wxGetTranslation(validation_layer_desc),
vconfig.bEnableValidationLayer));
wxStaticBoxSizer* const group_debug = wxStaticBoxSizer* const group_debug =
new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging")); new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Debugging"));

View File

@ -73,6 +73,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsClipControl = true; g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsDepthClamp = true; g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsReversedDepthRange = false; g_Config.backend_info.bSupportsReversedDepthRange = false;
g_Config.backend_info.bSupportsMultithreading = false;
IDXGIFactory* factory; IDXGIFactory* factory;
IDXGIAdapter* ad; IDXGIAdapter* ad;

View File

@ -76,6 +76,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsClipControl = true; g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsDepthClamp = true; g_Config.backend_info.bSupportsDepthClamp = true;
g_Config.backend_info.bSupportsReversedDepthRange = false; g_Config.backend_info.bSupportsReversedDepthRange = false;
g_Config.backend_info.bSupportsMultithreading = false;
IDXGIFactory* factory; IDXGIFactory* factory;
IDXGIAdapter* ad; IDXGIAdapter* ad;

View File

@ -34,6 +34,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsPostProcessing = false; g_Config.backend_info.bSupportsPostProcessing = false;
g_Config.backend_info.bSupportsPaletteConversion = true; g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsClipControl = true; g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsMultithreading = false;
// aamodes: We only support 1 sample, so no MSAA // aamodes: We only support 1 sample, so no MSAA
g_Config.backend_info.AAModes = {1}; g_Config.backend_info.AAModes = {1};

View File

@ -103,6 +103,7 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.bSupportsPostProcessing = true; g_Config.backend_info.bSupportsPostProcessing = true;
g_Config.backend_info.bSupportsSSAA = true; g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsReversedDepthRange = true; g_Config.backend_info.bSupportsReversedDepthRange = true;
g_Config.backend_info.bSupportsMultithreading = false;
// Overwritten in Render.cpp later // Overwritten in Render.cpp later
g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsDualSourceBlend = true;

View File

@ -130,6 +130,7 @@ void VideoSoftware::InitBackendInfo()
g_Config.backend_info.bSupportsEarlyZ = true; g_Config.backend_info.bSupportsEarlyZ = true;
g_Config.backend_info.bSupportsOversizedViewports = true; g_Config.backend_info.bSupportsOversizedViewports = true;
g_Config.backend_info.bSupportsPrimitiveRestart = false; g_Config.backend_info.bSupportsPrimitiveRestart = false;
g_Config.backend_info.bSupportsMultithreading = false;
// aamodes // aamodes
g_Config.backend_info.AAModes = {1}; g_Config.backend_info.AAModes = {1};

View File

@ -41,6 +41,10 @@ VideoConfig::VideoConfig()
// disable all features by default // disable all features by default
backend_info.api_type = APIType::Nothing; backend_info.api_type = APIType::Nothing;
backend_info.bSupportsExclusiveFullscreen = false; backend_info.bSupportsExclusiveFullscreen = false;
backend_info.bSupportsMultithreading = false;
bEnableValidationLayer = false;
bBackendMultithreading = true;
} }
void VideoConfig::Load(const std::string& ini_file) void VideoConfig::Load(const std::string& ini_file)
@ -82,6 +86,8 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("WireFrame", &bWireFrame, 0); settings->Get("WireFrame", &bWireFrame, 0);
settings->Get("DisableFog", &bDisableFog, 0); settings->Get("DisableFog", &bDisableFog, 0);
settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false); settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false);
settings->Get("EnableValidationLayer", &bEnableValidationLayer, false);
settings->Get("BackendMultithreading", &bBackendMultithreading, true);
settings->Get("SWZComploc", &bZComploc, true); settings->Get("SWZComploc", &bZComploc, true);
settings->Get("SWZFreeze", &bZFreeze, true); settings->Get("SWZFreeze", &bZFreeze, true);
@ -188,6 +194,7 @@ void VideoConfig::GameIniLoad()
} }
CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog); CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog);
CHECK_SETTING("Video_Settings", "BackendMultithreading", bBackendMultithreading);
CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering); CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering);
CHECK_SETTING("Video_Enhancements", "MaxAnisotropy", CHECK_SETTING("Video_Enhancements", "MaxAnisotropy",
@ -291,6 +298,8 @@ void VideoConfig::Save(const std::string& ini_file)
settings->Set("Wireframe", bWireFrame); settings->Set("Wireframe", bWireFrame);
settings->Set("DisableFog", bDisableFog); settings->Set("DisableFog", bDisableFog);
settings->Set("BorderlessFullscreen", bBorderlessFullscreen); settings->Set("BorderlessFullscreen", bBorderlessFullscreen);
settings->Set("EnableValidationLayer", bEnableValidationLayer);
settings->Set("BackendMultithreading", bBackendMultithreading);
settings->Set("SWZComploc", bZComploc); settings->Set("SWZComploc", bZComploc);
settings->Set("SWZFreeze", bZFreeze); settings->Set("SWZFreeze", bZFreeze);

View File

@ -143,6 +143,12 @@ struct VideoConfig final
bool bDumpTevStages; bool bDumpTevStages;
bool bDumpTevTextureFetches; bool bDumpTevTextureFetches;
// Enable API validation layers, currently only supported with Vulkan.
bool bEnableValidationLayer;
// Multithreaded submission, currently only supported with Vulkan.
bool bBackendMultithreading;
// Static config per API // Static config per API
// TODO: Move this out of VideoConfig // TODO: Move this out of VideoConfig
struct struct
@ -173,6 +179,7 @@ struct VideoConfig final
bool bSupportsSSAA; bool bSupportsSSAA;
bool bSupportsDepthClamp; // Needed by VertexShaderGen, so must stay in VideoCommon bool bSupportsDepthClamp; // Needed by VertexShaderGen, so must stay in VideoCommon
bool bSupportsReversedDepthRange; bool bSupportsReversedDepthRange;
bool bSupportsMultithreading;
} backend_info; } backend_info;
// Utility // Utility