From c7b2f9d1d2e70b694c0341ce285a81da7a2c9554 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 15 Aug 2015 13:20:54 +0200 Subject: [PATCH] gsdx-ogl: setup fbo to always write to first buffer GL_NONE was kind of useless because nothing was attached anyway --- plugins/GSdx/GSDeviceOGL.cpp | 16 ++++++---------- plugins/GSdx/GSDeviceOGL.h | 1 - plugins/GSdx/GSRendererOGL.cpp | 2 -- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 88e1692383..876af1bee9 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -205,6 +205,12 @@ bool GSDeviceOGL::Create(GSWnd* wnd) m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0)); gl_GenFramebuffers(1, &m_fbo); + // Always write to the first buffer + OMSetFBO(m_fbo); + GLenum target[1] = {GL_COLOR_ATTACHMENT0}; + gl_DrawBuffers(1, target); + OMSetFBO(0); + gl_GenFramebuffers(1, &m_fbo_read); // Always read from the first buffer gl_BindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read); @@ -1211,9 +1217,7 @@ void GSDeviceOGL::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* ver if (GLState::blend) { glDisable(GL_BLEND); } - // normally ok without any RT if GL_ARB_framebuffer_no_attachments is supported (minus driver bug) OMSetRenderTargets(NULL, ds, &GLState::scissor); - OMSetColorMaskState(); // TODO: likely useless // ia @@ -1324,12 +1328,6 @@ void GSDeviceOGL::OMSetFBO(GLuint fbo) } } -void GSDeviceOGL::OMSetWriteBuffer(GLenum buffer) -{ - GLenum target[1] = {buffer}; - gl_DrawBuffers(1, target); -} - void GSDeviceOGL::OMSetDepthStencilState(GSDepthStencilOGL* dss) { dss->SetupDepth(); @@ -1394,10 +1392,8 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto if (rt == NULL || !RT->IsBackbuffer()) { OMSetFBO(m_fbo); if (rt) { - OMSetWriteBuffer(); OMAttachRt(RT); } else { - OMSetWriteBuffer(GL_NONE); OMAttachRt(); } diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 189d102229..dd201ede62 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -529,7 +529,6 @@ class GSDeviceOGL : public GSDevice void OMSetDepthStencilState(GSDepthStencilOGL* dss); void OMSetBlendState(uint8 blend_index = 0, uint8 blend_factor = 0, bool is_blend_constant = false); void OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4i* scissor = NULL); - void OMSetWriteBuffer(GLenum buffer = GL_COLOR_ATTACHMENT0); void OMSetColorMaskState(OMColorMaskSelector sel = OMColorMaskSelector()); diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index c3b9e098a0..8439f32903 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -906,13 +906,11 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // Don't write anything on the color buffer // Neither in the depth buffer - dev->OMSetWriteBuffer(GL_NONE); glDepthMask(false); // Compute primitiveID max that pass the date test SendDraw(false); // Ask PS to discard shader above the primitiveID max - dev->OMSetWriteBuffer(); glDepthMask(GLState::depth_mask); ps_sel.date = 3;