diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 7dfa0229ea..ed5189d749 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -487,20 +487,20 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c) void GSDeviceOGL::ClearRenderTarget_ui(GSTexture* t, uint32 c) { + // Keep SCISSOR_TEST enabled on purpose to reduce the size + // of clean in DATE (impact big upscaling) uint32 col[4] = {c, c, c, c}; - glDisable(GL_SCISSOR_TEST); - OMSetFBO(m_fbo); OMAttachRt(static_cast(t)->GetID()); gl_ClearBufferuiv(GL_COLOR, 0, col); - - glEnable(GL_SCISSOR_TEST); } void GSDeviceOGL::ClearDepth(GSTexture* t, float c) { + // Keep SCISSOR_TEST enabled on purpose to reduce the size + // of clean in DATE (impact big upscaling) OMSetFBO(m_fbo); OMAttachDs(static_cast(t)->GetID()); @@ -521,9 +521,7 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c) OMAttachDs(static_cast(t)->GetID()); GLint color = c; - glDisable(GL_SCISSOR_TEST); gl_ClearBufferiv(GL_STENCIL, 0, &color); - glEnable(GL_SCISSOR_TEST); } GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel) diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index 097569cdc3..b9f97888ea 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -216,13 +216,21 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour if(DATE) { + // TODO: do I need to clamp the value (if yes how? rintersect with rt?) + GSVector4 si = GSVector4(rtscale.x, rtscale.y); + GSVector4 o = GSVector4(-1.0f, 1.0f); // Round value + GSVector4 b = m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy(); + GSVector4i ri = GSVector4i(b * si.xyxy()); + + // Reduce the quantity of clean function + glScissor( ri.x, ri.y, ri.width(), ri.height() ); + // Note at the moment OGL has always stencil. Rt can be disabled if(dev->HasStencil() && !advance_DATE) { GSVector4 s = GSVector4(rtscale.x / rtsize.x, rtscale.y / rtsize.y); - GSVector4 o = GSVector4(-1.0f, 1.0f); - GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + o.xxyy()) * s.xyxy()).sat(o.zzyy()); + GSVector4 src = (b * s.xyxy()).sat(o.zzyy()); GSVector4 dst = src * 2.0f + o.xxxx(); GSVertexPT1 vertices[] = @@ -240,6 +248,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // Create an r32ui image that will containt primitive ID if (advance_DATE) dev->InitPrimDateTexture(rtsize.x, rtsize.y); + + // Restore the scissor state + ri = GLState::scissor; + glScissor( ri.x, ri.y, ri.width(), ri.height() ); } //