From 98b9acf0d3879d9a49f82ff4ff22886033ddcdce Mon Sep 17 00:00:00 2001 From: arnastia Date: Tue, 25 Jun 2013 19:14:10 +0100 Subject: [PATCH] Add FramebuffersToMem option to allow disabling of reading framebuffer contents to memory (defaults to false). --- Core/Config.cpp | 2 ++ Core/Config.h | 1 + GPU/GLES/Framebuffer.cpp | 60 +++++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 146f20e29fb4..f004f5b604eb 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -114,6 +114,7 @@ void Config::Load(const char *iniFileName) #endif graphics->Get("StretchToDisplay", &bStretchToDisplay, false); graphics->Get("TrueColor", &bTrueColor, true); + graphics->Get("FramebuffersToMem", &bFramebuffersToMem, false); graphics->Get("MipMap", &bMipMap, true); graphics->Get("TexScalingLevel", &iTexScalingLevel, 1); graphics->Get("TexScalingType", &iTexScalingType, 0); @@ -216,6 +217,7 @@ void Config::Save() #endif graphics->Set("StretchToDisplay", bStretchToDisplay); graphics->Set("TrueColor", bTrueColor); + graphics->Set("FramebuffersToMem", bFramebuffersToMem); graphics->Set("MipMap", bMipMap); graphics->Set("TexScalingLevel", iTexScalingLevel); graphics->Set("TexScalingType", iTexScalingType); diff --git a/Core/Config.h b/Core/Config.h index 9881c582bcb3..251d4229a366 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -79,6 +79,7 @@ struct Config bool bFullScreen; int iAnisotropyLevel; bool bTrueColor; + bool bFramebuffersToMem; bool bMipMap; int iTexScalingLevel; // 1 = off, 2 = 2x, ..., 5 = 5x int iTexScalingType; // 0 = xBRZ, 1 = Hybrid diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 9ee84bc33a3d..d936f20204be 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -408,8 +408,9 @@ void FramebufferManager::SetRenderFrameBuffer() { // Save current render framebuffer to memory if(currentRenderVfb_) { - // TODO: Add a way to disable the call since it is rather expensive. - ReadFramebufferToMemory(currentRenderVfb_); + if(g_Config.bFramebuffersToMem) { + ReadFramebufferToMemory(currentRenderVfb_); + } } // None found? Create one. @@ -604,8 +605,9 @@ void FramebufferManager::CopyDisplayToOutput() { glBindTexture(GL_TEXTURE_2D, 0); } - // TODO: Add a way to disable the call since it is rather expensive. - ReadFramebufferToMemory(vfb); + if(g_Config.bFramebuffersToMem) { + ReadFramebufferToMemory(vfb); + } if (resized_) { glstate.depthWrite.set(GL_TRUE); @@ -775,31 +777,31 @@ void FramebufferManager::ReadFramebufferToMemory(VirtualFramebuffer *vfb) { int pixelType, pixelSize, pixelFormat, align; switch (vfb->format) { - case GE_FORMAT_4444: // 16 bit ABGR - pixelType = GL_UNSIGNED_SHORT_4_4_4_4_REV; - pixelFormat = GL_RGBA; - pixelSize = 2; - align = 8; - break; - case GE_FORMAT_5551: // 16 bit ABGR - pixelType = GL_UNSIGNED_SHORT_1_5_5_5_REV; - pixelFormat = GL_RGBA; - pixelSize = 2; - align = 8; - break; - case GE_FORMAT_565: // 16 bit BGR - pixelType = GL_UNSIGNED_SHORT_5_6_5_REV; - pixelFormat = GL_RGB; - pixelSize = 2; - align = 8; - break; - case GE_FORMAT_8888: // 32 bit ABGR - default: // And same as above - pixelType = GL_UNSIGNED_INT_8_8_8_8_REV; - pixelFormat = GL_RGBA; - pixelSize = 4; - align = 4; - break; + case GE_FORMAT_4444: // 16 bit ABGR + pixelType = GL_UNSIGNED_SHORT_4_4_4_4_REV; + pixelFormat = GL_RGBA; + pixelSize = 2; + align = 8; + break; + case GE_FORMAT_5551: // 16 bit ABGR + pixelType = GL_UNSIGNED_SHORT_1_5_5_5_REV; + pixelFormat = GL_RGBA; + pixelSize = 2; + align = 8; + break; + case GE_FORMAT_565: // 16 bit BGR + pixelType = GL_UNSIGNED_SHORT_5_6_5_REV; + pixelFormat = GL_RGB; + pixelSize = 2; + align = 8; + break; + case GE_FORMAT_8888: // 32 bit ABGR + default: // And same as above + pixelType = GL_UNSIGNED_INT_8_8_8_8_REV; + pixelFormat = GL_RGBA; + pixelSize = 4; + align = 4; + break; } if (useBufferedRendering_) {