diff --git a/Core/Config.cpp b/Core/Config.cpp index 3a9e62dc29c4..2bffb81763c2 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -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[] = { diff --git a/Core/Config.h b/Core/Config.h index eeb6d51f2ffe..fa6be416bb42 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -213,6 +213,8 @@ struct Config { 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 vPostShaderNames; // Off for chain end (only Off for no shader) std::map mPostShaderSetting; diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index f196563428a1..5da2b65fad84 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -275,7 +275,8 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView int format = gstate_c.depalFramebufferFormat; uint32_t val = BytesToUint32(indexMask, indexShift, indexOffset, format); // Poke in a bilinear filter flag in the top bit. - val |= gstate.isMagnifyFilteringEnabled() << 31; + if (gstate.isMagnifyFilteringEnabled()) + val |= 0x80000000; ub->depal_mask_shift_off_fmt = val; } } diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 8b8a430e6d28..c92b8ad2f5e3 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -108,8 +108,6 @@ u32 GPU_D3D11::CheckGPUFeatures() const { features |= GPU_USE_16BIT_FORMATS; } - features |= GPU_USE_FRAGMENT_UBERSHADER; - return CheckGPUFeaturesLate(features); } diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 7442d019f080..6d5bb85d2c73 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -102,9 +102,6 @@ u32 GPU_DX9::CheckGPUFeatures() const { // So we cannot incorrectly use the viewport transform as the depth range on Direct3D. features |= GPU_USE_ACCURATE_DEPTH; - // DX9 GPUs probably benefit more than they lose from this. Though, might be a vendor check. - features |= GPU_USE_FRAGMENT_UBERSHADER; - return CheckGPUFeaturesLate(features); } diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index c59ca74aa81c..8c4e354a706a 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -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; } diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 701cfb1651e1..3929929ed67e 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -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; } diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 7c66a7a1709e..b4734dc2d3b2 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -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; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 5c030e900480..110c74f07053 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -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 stereoShaderNames; diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index c8ee58af065f..6dbb175f3d8c 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -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]