From 8f9a2b988288ca61e0adbcffe8cdbf7e72b7aaec Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 12 May 2014 21:47:55 -0700 Subject: [PATCH] Unbind the fbo texture when it's not used. Just in case there are problems with decimating it or etc. --- GPU/GLES/StateMapping.cpp | 8 +++++++- GPU/GLES/TransformPipeline.cpp | 3 ++- GPU/GLES/TransformPipeline.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 833c14dce2..c89173fadf 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -171,7 +171,7 @@ void TransformDrawEngine::ApplyDrawState(int prim) { gstate_c.textureChanged = TEXCHANGE_UNCHANGED; } - // Set blend + // Set blend - unless we need to do it in the shader. bool wantBlend = !gstate.isModeClear() && gstate.isAlphaBlendEnabled(); if (wantBlend && ShouldUseShaderBlending()) { if (!gl_extensions.NV_shader_framebuffer_fetch) { @@ -191,10 +191,16 @@ void TransformDrawEngine::ApplyDrawState(int prim) { glActiveTexture(GL_TEXTURE1); framebufferManager_->BindFramebufferColor(NULL); glActiveTexture(GL_TEXTURE0); + fboTexBound_ = true; } // None of the below logic is interesting, we're gonna do it entirely in the shader. wantBlend = false; + } else if (fboTexBound_) { + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, 0); + glActiveTexture(GL_TEXTURE0); } + glstate.blend.set(wantBlend); if (wantBlend) { // This can't be done exactly as there are several PSP blend modes that are impossible to do on OpenGL ES 2.0, and some even on regular OpenGL for desktop. diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index b9ac5c2800..0c96223e2d 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -126,7 +126,8 @@ TransformDrawEngine::TransformDrawEngine() numDrawCalls(0), vertexCountInDrawCalls(0), decodeCounter_(0), - uvScale(0) { + uvScale(0), + fboTexBound_(false) { decimationCounter_ = VERTEXCACHE_DECIMATION_INTERVAL; // Allocate nicely aligned memory. Maybe graphics drivers will // appreciate it. diff --git a/GPU/GLES/TransformPipeline.h b/GPU/GLES/TransformPipeline.h index 8e23c78c52..4795224e83 100644 --- a/GPU/GLES/TransformPipeline.h +++ b/GPU/GLES/TransformPipeline.h @@ -243,4 +243,6 @@ private: u32 dcid_; UVScale *uvScale; + + bool fboTexBound_; };