Add checkboxes in developer tools to allow disabling ubershaders.

Might be helpful to diagnose performance problems on user devices.

Additionally, moves the texture replacement controls to the top. They
should probably be moved somewhere else entirely...

See #17918
This commit is contained in:
Henrik Rydgård 2023-08-17 20:16:04 +02:00
parent abaf45e552
commit 8a6e288fcc
8 changed files with 55 additions and 33 deletions

View file

@ -633,6 +633,9 @@ static const ConfigSetting graphicsSettings[] = {
ConfigSetting("ShaderCache", &g_Config.bShaderCache, true, CfgFlag::DONT_SAVE), // Doesn't save. Ini-only.
ConfigSetting("GpuLogProfiler", &g_Config.bGpuLogProfiler, false, CfgFlag::DEFAULT),
ConfigSetting("UberShaderVertex", &g_Config.bUberShaderVertex, true, CfgFlag::DEFAULT),
ConfigSetting("UberShaderFragment", &g_Config.bUberShaderFragment, true, CfgFlag::DEFAULT),
};
static const ConfigSetting soundSettings[] = {

View file

@ -213,6 +213,8 @@ public:
int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High
bool bHardwareTessellation;
bool bShaderCache; // Hidden ini-only setting, useful for debugging shader compile times.
bool bUberShaderVertex;
bool bUberShaderFragment;
std::vector<std::string> vPostShaderNames; // Off for chain end (only Off for no shader)
std::map<std::string, float> mPostShaderSetting;

View file

@ -108,8 +108,6 @@ u32 GPU_D3D11::CheckGPUFeatures() const {
features |= GPU_USE_16BIT_FORMATS;
}
features |= GPU_USE_FRAGMENT_UBERSHADER;
return CheckGPUFeaturesLate(features);
}

View file

@ -177,6 +177,11 @@ u32 GPU_GLES::CheckGPUFeatures() const {
features |= GPU_USE_SINGLE_PASS_STEREO;
}
if (!gl_extensions.GLES3) {
// Heuristic.
features &= ~GPU_USE_FRAGMENT_UBERSHADER;
}
features = CheckGPUFeaturesLate(features);
if (draw_->GetBugs().Has(Draw::Bugs::ADRENO_RESOURCE_DEADLOCK) && g_Config.bVendorBugChecksEnabled) {
@ -193,11 +198,6 @@ u32 GPU_GLES::CheckGPUFeatures() const {
features |= GPU_ROUND_DEPTH_TO_16BIT;
}
}
if (gl_extensions.GLES3) {
features |= GPU_USE_FRAGMENT_UBERSHADER;
}
return features;
}

View file

@ -611,7 +611,7 @@ u32 GPUCommonHW::CheckGPUFeatures() const {
features |= GPU_USE_FRAMEBUFFER_FETCH;
}
if (draw_->GetShaderLanguageDesc().bitwiseOps) {
if (draw_->GetShaderLanguageDesc().bitwiseOps && g_Config.bUberShaderVertex) {
features |= GPU_USE_LIGHT_UBERSHADER;
}
@ -624,6 +624,11 @@ u32 GPUCommonHW::CheckGPUFeatures() const {
features |= GPU_USE_ACCURATE_DEPTH;
}
// Some backends will turn this off again in the calling function.
if (g_Config.bUberShaderFragment) {
features |= GPU_USE_FRAGMENT_UBERSHADER;
}
return features;
}

View file

@ -285,10 +285,6 @@ u32 GPU_Vulkan::CheckGPUFeatures() const {
}
}
// Only a few low-power GPUs should probably avoid this.
// Let's figure that out later.
features |= GPU_USE_FRAGMENT_UBERSHADER;
// Attempt to workaround #17386
if (draw_->GetBugs().Has(Draw::Bugs::UNIFORM_INDEXING_BROKEN)) {
features &= ~GPU_USE_LIGHT_UBERSHADER;

View file

@ -1637,6 +1637,26 @@ void DeveloperToolsScreen::CreateViews() {
LinearLayout *list = settingsScroll->Add(new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->SetSpacing(0);
list->Add(new ItemHeader(dev->T("Texture Replacement")));
list->Add(new CheckBox(&g_Config.bSaveNewTextures, dev->T("Save new textures")));
list->Add(new CheckBox(&g_Config.bReplaceTextures, dev->T("Replace textures")));
Choice *createTextureIni = list->Add(new Choice(dev->T("Create/Open textures.ini file for current game")));
createTextureIni->OnClick.Handle(this, &DeveloperToolsScreen::OnOpenTexturesIniFile);
createTextureIni->SetEnabledFunc([&] {
if (!PSP_IsInited())
return false;
// Disable the choice to Open/Create if the textures.ini file already exists, and we can't open it due to platform support limitations.
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR)) {
if (hasTexturesIni_ == HasIni::MAYBE)
hasTexturesIni_ = TextureReplacer::IniExists(g_paramSFO.GetDiscID()) ? HasIni::YES : HasIni::NO;
return hasTexturesIni_ != HasIni::YES;
}
return true;
});
list->Add(new ItemHeader(sy->T("General")));
bool canUseJit = true;
@ -1697,27 +1717,22 @@ void DeveloperToolsScreen::CreateViews() {
if (GetGPUBackend() == GPUBackend::VULKAN) {
list->Add(new CheckBox(&g_Config.bGpuLogProfiler, dev->T("GPU log profiler")));
}
list->Add(new ItemHeader(dev->T("Texture Replacement")));
list->Add(new CheckBox(&g_Config.bSaveNewTextures, dev->T("Save new textures")));
list->Add(new CheckBox(&g_Config.bReplaceTextures, dev->T("Replace textures")));
Choice *createTextureIni = list->Add(new Choice(dev->T("Create/Open textures.ini file for current game")));
createTextureIni->OnClick.Handle(this, &DeveloperToolsScreen::OnOpenTexturesIniFile);
createTextureIni->SetEnabledFunc([&] {
if (!PSP_IsInited())
return false;
// Disable the choice to Open/Create if the textures.ini file already exists, and we can't open it due to platform support limitations.
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR)) {
if (hasTexturesIni_ == HasIni::MAYBE)
hasTexturesIni_ = TextureReplacer::IniExists(g_paramSFO.GetDiscID()) ? HasIni::YES : HasIni::NO;
return hasTexturesIni_ != HasIni::YES;
}
return true;
});
Draw::DrawContext *draw = screenManager()->getDrawContext();
list->Add(new ItemHeader(dev->T("Ubershaders")));
if (draw->GetShaderLanguageDesc().bitwiseOps && !draw->GetBugs().Has(Draw::Bugs::UNIFORM_INDEXING_BROKEN)) {
// If the above if fails, the checkbox is redundant since it'll be force disabled anyway.
list->Add(new CheckBox(&g_Config.bUberShaderVertex, dev->T("Vertex")));
}
#if !PPSSPP_PLATFORM(UWP)
if (g_Config.iGPUBackend != (int)GPUBackend::OPENGL || gl_extensions.GLES3) {
#else
{
#endif
list->Add(new CheckBox(&g_Config.bUberShaderFragment, dev->T("Fragment")));
}
// Experimental, will move to main graphics settings later.
bool multiViewSupported = draw->GetDeviceCaps().multiViewSupported;
@ -1725,7 +1740,7 @@ void DeveloperToolsScreen::CreateViews() {
return g_Config.bStereoRendering && multiViewSupported;
};
if (draw->GetDeviceCaps().multiViewSupported) {
if (multiViewSupported) {
list->Add(new ItemHeader(gr->T("Stereo rendering")));
list->Add(new CheckBox(&g_Config.bStereoRendering, gr->T("Stereo rendering")));
std::vector<std::string> stereoShaderNames;

View file

@ -296,9 +296,11 @@ xBRZ = &xBRZ
[Developer]
Allocator Viewer = Allocator viewer (Vulkan)
Allow remote debugger = Allow remote debugger
Audio Debug = Audio Debug
Backspace = Backspace
Block address = Block address
By Address = By address
Control Debug = Control Debug
Copy savestates to memstick root = Copy save states to Memory Stick root
Create/Open textures.ini file for current game = Create/Open textures.ini file for current game
Current = Current
@ -311,6 +313,7 @@ Dump next frame to log = Dump next frame to log
Enable driver bug workarounds = Enable driver bug workarounds
Enable Logging = Enable debug logging
Enter address = Enter address
Fragment = Fragment
FPU = FPU
Framedump tests = Framedump tests
Frame Profiler = Frame profiler
@ -344,10 +347,10 @@ Stats = Stats
System Information = System information
Texture ini file created = Texture ini file created
Texture Replacement = Texture replacement
Audio Debug = Audio Debug
Control Debug = Control Debug
Toggle Freeze = Toggle freeze
Touchscreen Test = Touchscreen test
Ubershaders = Ubershaders
Vertex = Vertex
VFPU = VFPU
[Dialog]