gsdx-ogl: setup fbo to always write to first buffer

GL_NONE was kind of useless because nothing was attached anyway
This commit is contained in:
Gregory Hainaut 2015-08-15 13:20:54 +02:00
parent 87f497af0a
commit c7b2f9d1d2
3 changed files with 6 additions and 13 deletions

View File

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

View File

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

View File

@ -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;