diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index 3c20f81af0..09d38bb731 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -57,7 +57,7 @@ void OpenGL_ReportARBProgramError(); GLuint OpenGL_ReportGLError(const char *function, const char *file, int line); bool OpenGL_ReportFBOError(const char *function, const char *file, int line); -#if defined(_DEBUG) || defined(DEBUGFAST) || 1 +#if defined(_DEBUG) || defined(DEBUGFAST) #define GL_REPORT_ERROR() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__) #define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError(__FUNCTION__, __FILE__, __LINE__) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index cf7a5dbaf4..9026ead8ff 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1254,50 +1254,58 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons else { TargetRectangle targetRc = ConvertEFBRectangle(rc); - GLuint read_texture = FramebufferManager::ResolveAndGetRenderTarget(rc); - // Render to the real buffer now. - glBindFramebuffer(GL_FRAMEBUFFER, 0); // switch to the window backbuffer - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, read_texture); + if(applyShader) { + GLuint read_texture = FramebufferManager::ResolveAndGetRenderTarget(rc); + // Render to the real buffer now. + glBindFramebuffer(GL_FRAMEBUFFER, 0); // switch to the window backbuffer + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, read_texture); - if(!( s_cached_targetRc == targetRc)) { - GLfloat vertices[] = { - -1.0f, -1.0f, 1.0f, - (GLfloat)targetRc.left, (GLfloat)targetRc.bottom, - 0.0f, 0.0f, + if(!( s_cached_targetRc == targetRc)) { + GLfloat vertices[] = { + -1.0f, -1.0f, 1.0f, + (GLfloat)targetRc.left, (GLfloat)targetRc.bottom, + 0.0f, 0.0f, + + -1.0f, 1.0f, 1.0f, + (GLfloat)targetRc.left, (GLfloat)targetRc.top, + 0.0f, 1.0f, + + 1.0f, 1.0f, 1.0f, + (GLfloat)targetRc.right, (GLfloat)targetRc.top, + 1.0f, 1.0f, + + 1.0f, -1.0f, 1.0f, + (GLfloat)targetRc.right, (GLfloat)targetRc.bottom, + 1.0f, 0.0f + }; - -1.0f, 1.0f, 1.0f, - (GLfloat)targetRc.left, (GLfloat)targetRc.top, - 0.0f, 1.0f, - - 1.0f, 1.0f, 1.0f, - (GLfloat)targetRc.right, (GLfloat)targetRc.top, - 1.0f, 1.0f, - - 1.0f, -1.0f, 1.0f, - (GLfloat)targetRc.right, (GLfloat)targetRc.bottom, - 1.0f, 0.0f - }; + glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO); + glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO); - glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - - s_cached_targetRc = targetRc; - } - - glBindVertexArray(s_Swap_VAO[applyShader]); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + s_cached_targetRc = targetRc; + } + + glBindVertexArray(s_Swap_VAO[applyShader]); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - // TODO: this after merging with graphic_update - glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); - - if(applyShader) + + // TODO: this after merging with graphic_update + glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + PixelShaderCache::DisableShader(); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); + OGL::TextureCache::DisableStage(0); + + } else { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer()); + glBlitFramebuffer(targetRc.left, targetRc.bottom, targetRc.right, targetRc.top, + flipped_trc.left, flipped_trc.bottom, flipped_trc.right, flipped_trc.top, + GL_COLOR_BUFFER_BIT, GL_LINEAR); + } } - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); - OGL::TextureCache::DisableStage(0); // Save screenshot if (s_bScreenshot)