gsdx-ogl: avoid to clean fully texture in DATE

Is is useless and it has a small impact on performance for big upscale
This commit is contained in:
Gregory Hainaut 2015-04-24 18:32:08 +02:00
parent 03e72781aa
commit 6e386df535
2 changed files with 18 additions and 8 deletions

View File

@ -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<GSTextureOGL*>(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<GSTextureOGL*>(t)->GetID());
@ -521,9 +521,7 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
OMAttachDs(static_cast<GSTextureOGL*>(t)->GetID());
GLint color = c;
glDisable(GL_SCISSOR_TEST);
gl_ClearBufferiv(GL_STENCIL, 0, &color);
glEnable(GL_SCISSOR_TEST);
}
GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)

View File

@ -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() );
}
//