From a5e424512c6e29e31fb75d94c1eec9bb3b05b234 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 15 May 2015 15:24:43 +0200 Subject: [PATCH] gsdx-ogl: really avoid consecutive clean --- plugins/GSdx/GSDeviceOGL.cpp | 5 ++++- plugins/GSdx/GSTextureOGL.cpp | 6 ------ plugins/GSdx/GSTextureOGL.h | 3 ++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 49e23be700..573265179d 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -442,7 +442,7 @@ void GSDeviceOGL::DrawIndexedPrimitive(int offset, int count) void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c) { GSTextureOGL* T = static_cast(t); - if (T->HasBeenCleaned()) + if (T->HasBeenCleaned() && !T->IsBackbuffer()) return; GL_PUSH(format("Clear RT %d", T->GetID()).c_str()); @@ -464,12 +464,15 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c) OMAttachRt(T); gl_ClearBufferfv(GL_COLOR, 0, c.v); + } OMSetColorMaskState(OMColorMaskSelector(old_color_mask)); glEnable(GL_SCISSOR_TEST); + T->WasCleaned(); + GL_POP(); } diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 8746370a95..2e750fd0fb 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -258,12 +258,6 @@ void GSTextureOGL::Invalidate() } } -bool GSTextureOGL::HasBeenCleaned() { - bool old = m_clean; - m_clean = true; - return old; -} - bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch) { ASSERT(m_type != GSTexture::DepthStencil && m_type != GSTexture::Offscreen); diff --git a/plugins/GSdx/GSTextureOGL.h b/plugins/GSdx/GSTextureOGL.h index 19794d99b5..ab5786b07a 100644 --- a/plugins/GSdx/GSTextureOGL.h +++ b/plugins/GSdx/GSTextureOGL.h @@ -79,6 +79,7 @@ class GSTextureOGL : public GSTexture uint32 GetID() { return m_texture_id; } GLuint64 GetHandle(GLuint sampler_id); - bool HasBeenCleaned(); + bool HasBeenCleaned() { return m_clean; } void WasAttached() { m_clean = false; m_dirty = true; } + void WasCleaned() { m_clean = true; } };