From 5f99f663efa3fc469ce4da40f3f518bd840433a3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 26 May 2014 21:26:40 -0700 Subject: [PATCH] Avoid duplicating an FBO when depaletizing it. --- GPU/GLES/Framebuffer.cpp | 4 ++-- GPU/GLES/Framebuffer.h | 2 +- GPU/GLES/TextureCache.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 5344f05033..d1de28ef07 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -1014,7 +1014,7 @@ void FramebufferManager::BindFramebufferDepth(VirtualFramebuffer *sourceframebuf } } -void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer) { +void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy) { if (framebuffer == NULL) { framebuffer = currentRenderVfb_; } @@ -1027,7 +1027,7 @@ void FramebufferManager::BindFramebufferColor(VirtualFramebuffer *framebuffer) { // 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 (currentRenderVfb_ && MaskedEqual(framebuffer->fb_address, gstate.getFrameBufRawAddress())) { + if (!skipCopy && currentRenderVfb_ && MaskedEqual(framebuffer->fb_address, gstate.getFrameBufRawAddress())) { #ifndef USING_GLES2 if (gl_extensions.FBO_ARB) { bool useNV = false; diff --git a/GPU/GLES/Framebuffer.h b/GPU/GLES/Framebuffer.h index cb9e1b22ad..26eee974e4 100644 --- a/GPU/GLES/Framebuffer.h +++ b/GPU/GLES/Framebuffer.h @@ -162,7 +162,7 @@ public: void BindFramebufferDepth(VirtualFramebuffer *sourceframebuffer, VirtualFramebuffer *targetframebuffer); // For use when texturing from a framebuffer. May create a duplicate if target. - void BindFramebufferColor(VirtualFramebuffer *framebuffer); + void BindFramebufferColor(VirtualFramebuffer *framebuffer, bool skipCopy = false); // Returns true if it's sure this is a direct FBO->FBO transfer and it has already handle it. // In that case we hardly need to actually copy the bytes in VRAM, they will be wrong anyway (unless diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 08e75fc192..3b809e4bcb 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -935,7 +935,7 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) { glBindTexture(GL_TEXTURE_2D, clutTexture); glActiveTexture(GL_TEXTURE0); - framebufferManager_->BindFramebufferColor(entry->framebuffer); + framebufferManager_->BindFramebufferColor(entry->framebuffer, true); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); entry->status |= TexCacheEntry::STATUS_TEXPARAM_DIRTY;