From 4a8d52ab1a7006b2afc44207e8a356a537de89fe Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 8 Jul 2014 23:32:41 -0700 Subject: [PATCH] Add a config option for the slow framebuf effects. Like cluts, blitting, etc. At higher render resolutions these are expensive, and on some mobile devices they may be too much. Of course, they're only used when needed so this is a speedhack. --- Core/Config.cpp | 3 ++- Core/Config.h | 1 + GPU/GLES/FragmentShaderGenerator.cpp | 8 ++++---- GPU/GLES/Framebuffer.cpp | 10 ++++++---- GPU/GLES/TextureCache.cpp | 2 +- GPU/GLES/TransformPipeline.cpp | 6 ++++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 13869a3b41..037304c816 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -397,7 +397,7 @@ static ConfigSetting graphicsSettings[] = { ConfigSetting("SmallDisplay", &g_Config.bSmallDisplay, false), ConfigSetting("ImmersiveMode", &g_Config.bImmersiveMode, false), - ConfigSetting("TrueColor", &g_Config.bTrueColor, true), + ReportedConfigSetting("TrueColor", &g_Config.bTrueColor, true), ReportedConfigSetting("MipMap", &g_Config.bMipMap, true), @@ -415,6 +415,7 @@ static ConfigSetting graphicsSettings[] = { ReportedConfigSetting("PostShader", &g_Config.sPostShaderName, "Off"), ReportedConfigSetting("MemBlockTransferGPU", &g_Config.bBlockTransferGPU, true), + ReportedConfigSetting("DisableSlowFramebufEffects", &g_Config.bDisableSlowFramebufEffects, true), ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index f6397fff3f..4c73036a79 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -146,6 +146,7 @@ public: bool bTimerHack; bool bAlphaMaskHack; bool bBlockTransferGPU; + bool bDisableSlowFramebufEffects; int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High std::string sPostShaderName; // Off for off. diff --git a/GPU/GLES/FragmentShaderGenerator.cpp b/GPU/GLES/FragmentShaderGenerator.cpp index 738f4d99ba..65364bd1e6 100644 --- a/GPU/GLES/FragmentShaderGenerator.cpp +++ b/GPU/GLES/FragmentShaderGenerator.cpp @@ -313,12 +313,12 @@ bool ShouldUseShaderBlending() { switch (eq) { case GE_BLENDMODE_ABSDIFF: - return true; + return !g_Config.bDisableSlowFramebufEffects; case GE_BLENDMODE_MIN: case GE_BLENDMODE_MAX: // These don't use the factors. - return !gl_extensions.EXT_blend_minmax && !gl_extensions.GLES3; + return !gl_extensions.EXT_blend_minmax && !gl_extensions.GLES3 && !g_Config.bDisableSlowFramebufEffects; default: break; @@ -334,7 +334,7 @@ bool ShouldUseShaderBlending() { case GE_SRCBLEND_DOUBLEINVSRCALPHA: case GE_SRCBLEND_DOUBLEDSTALPHA: case GE_SRCBLEND_DOUBLEINVDSTALPHA: - return true; + return !g_Config.bDisableSlowFramebufEffects; case GE_SRCBLEND_FIXA: if (funcB == GE_DSTBLEND_FIXB) { @@ -355,7 +355,7 @@ bool ShouldUseShaderBlending() { case GE_DSTBLEND_DOUBLEINVSRCALPHA: case GE_DSTBLEND_DOUBLEDSTALPHA: case GE_DSTBLEND_DOUBLEINVDSTALPHA: - return true; + return !g_Config.bDisableSlowFramebufEffects; default: break; diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index d0980e716e..3551c122ed 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -828,7 +828,9 @@ void FramebufferManager::ResizeFramebufFBO(VirtualFramebuffer *vfb, u16 w, u16 h INFO_LOG(SCEGE, "Resizing FBO for %08x : %i x %i x %i", vfb->fb_address, w, h, vfb->format); if (vfb->fbo) { ClearBuffer(); - BlitFramebuffer_(vfb, 0, 0, &old, 0, 0, std::min(vfb->bufferWidth, vfb->width), std::min(vfb->height, vfb->bufferHeight), 0); + if (!g_Config.bDisableSlowFramebufEffects) { + BlitFramebuffer_(vfb, 0, 0, &old, 0, 0, std::min(vfb->bufferWidth, vfb->width), std::min(vfb->height, vfb->bufferHeight), 0); + } } fbo_destroy(old.fbo); if (vfb->fbo) { @@ -1008,7 +1010,7 @@ void FramebufferManager::DoSetRenderFrameBuffer() { // Some AMD drivers crash if we don't clear the buffer first? ClearBuffer(); - if (useBufferedRendering_ && !updateVRAM_) { + if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) { gpu->PerformMemoryUpload(fb_address_mem, byteSize); NotifyStencilUpload(fb_address_mem, byteSize, true); // TODO: Is it worth trying to upload the depth buffer? @@ -1090,7 +1092,7 @@ void FramebufferManager::DoSetRenderFrameBuffer() { #endif // Copy depth pixel value from the read framebuffer to the draw framebuffer - if (currentRenderVfb_) { + if (currentRenderVfb_ && !g_Config.bDisableSlowFramebufEffects) { BlitFramebufferDepth(currentRenderVfb_, vfb); } currentRenderVfb_ = vfb; @@ -1202,7 +1204,7 @@ void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer, b // currentRenderVfb_ will always be set when this is called, except from the GE debugger. // Let's just not bother with the copy in that case. - if (GPUStepping::IsStepping()) { + if (GPUStepping::IsStepping() || g_Config.bDisableSlowFramebufEffects) { skipCopy = true; } if (!skipCopy && currentRenderVfb_ && framebuffer->fb_address == gstate.getFrameBufRawAddress()) { diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 878ea2f49d..529b9db651 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -1009,7 +1009,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffe bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE; if (useBufferedRendering) { GLuint program = 0; - if (entry->status & TexCacheEntry::STATUS_DEPALETTIZE) { + if ((entry->status & TexCacheEntry::STATUS_DEPALETTIZE) && !g_Config.bDisableSlowFramebufEffects) { program = depalShaderCache_->GetDepalettizeShader(framebuffer->format); } if (program) { diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 60de68f38a..06d5bcaf9a 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -332,8 +332,10 @@ void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType pr } if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) { - gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; - Flush(); + if (!g_Config.bDisableSlowFramebufEffects) { + gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; + Flush(); + } } }