Add option for the clear-fb-on-first-use speedhack. See #13295

This commit is contained in:
Henrik Rydgård 2020-09-10 23:47:54 +02:00
parent 10520470d1
commit 406fed7914
5 changed files with 13 additions and 6 deletions

View file

@ -818,6 +818,8 @@ static ConfigSetting graphicsSettings[] = {
ConfigSetting("InflightFrames", &g_Config.iInflightFrames, 3, true, false),
ConfigSetting("RenderDuplicateFrames", &g_Config.bRenderDuplicateFrames, false, true, true),
ConfigSetting("ClearFramebuffersOnFirstUseHack", &g_Config.bClearFramebuffersOnFirstUseHack, false, true, true),
ConfigSetting(false),
};

View file

@ -165,6 +165,7 @@ public:
int iFrameSkipType;
int iUnthrottleMode; // See UnthrottleMode in ConfigValues.h.
bool bAutoFrameSkip;
bool bClearFramebuffersOnFirstUseHack;
bool bEnableCardboardVR; // Cardboard Master Switch
int iCardboardScreenSize; // Screen Size (in %)

View file

@ -44,10 +44,6 @@ FramebufferManagerCommon::FramebufferManagerCommon(Draw::DrawContext *draw)
: draw_(draw),
displayFormat_(GE_FORMAT_565) {
presentation_ = new PresentationCommon(draw);
// See comment from where it's used below.
// As for the use of IsGLES, just the way it was. Scary to change it.
clearFramebufferOnFirstUseHack_ = gl_extensions.IsGLES;
}
FramebufferManagerCommon::~FramebufferManagerCommon() {
@ -536,7 +532,7 @@ void FramebufferManagerCommon::NotifyRenderFramebufferSwitched(VirtualFramebuffe
if (useBufferedRendering_) {
if (vfb->fbo) {
shaderManager_->DirtyLastShader();
if (clearFramebufferOnFirstUseHack_) {
if (g_Config.bClearFramebuffersOnFirstUseHack) {
// HACK: Some tiled mobile GPUs benefit IMMENSELY from clearing an FBO before rendering
// to it (or in Vulkan, clear during framebuffer load). This is a hack to force this
// the first time a framebuffer is bound for rendering in a frame.

View file

@ -396,7 +396,6 @@ protected:
std::vector<VirtualFramebuffer *> bvfbs_; // blitting framebuffers (for download)
bool gameUsesSequentialCopies_ = false;
bool clearFramebufferOnFirstUseHack_ = false;
// Sampled in BeginFrame for safety.
float renderWidth_ = 0.0f;

View file

@ -415,6 +415,15 @@ void GameSettingsScreen::CreateViews() {
return !g_Config.bSoftwareRendering && g_Config.bHardwareTransform;
});
CheckBox *clearHack = graphicsSettings->Add(new CheckBox(&g_Config.bClearFramebuffersOnFirstUseHack, gr->T("Clear Speedhack", "Clear framebuffers on first use (speedhack)")));
clearHack->OnClick.Add([=](EventParams &e) {
settingInfo_->Show(gr->T("ClearSpeedhack Tip", "Sometimes faster (mostly on mobile devices), may cause glitches"), e.v);
return UI::EVENT_CONTINUE;
});
clearHack->SetEnabledFunc([] {
return !g_Config.bSoftwareRendering;
});
CheckBox *texBackoff = graphicsSettings->Add(new CheckBox(&g_Config.bTextureBackoffCache, gr->T("Lazy texture caching", "Lazy texture caching (speedup)")));
texBackoff->SetDisabledPtr(&g_Config.bSoftwareRendering);