Add FramebuffersToMem option to allow disabling of reading framebuffer contents to memory (defaults to false).

This commit is contained in:
arnastia 2013-06-25 19:14:10 +01:00
parent 32efe2a9ad
commit 98b9acf0d3
3 changed files with 34 additions and 29 deletions

View File

@ -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);

View File

@ -79,6 +79,7 @@ public:
bool bFullScreen;
int iAnisotropyLevel;
bool bTrueColor;
bool bFramebuffersToMem;
bool bMipMap;
int iTexScalingLevel; // 1 = off, 2 = 2x, ..., 5 = 5x
int iTexScalingType; // 0 = xBRZ, 1 = Hybrid

View File

@ -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_) {