mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
87f497af0a
commit
c7b2f9d1d2
|
@ -205,6 +205,12 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
|
||||||
m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0));
|
m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0));
|
||||||
|
|
||||||
gl_GenFramebuffers(1, &m_fbo);
|
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);
|
gl_GenFramebuffers(1, &m_fbo_read);
|
||||||
// Always read from the first buffer
|
// Always read from the first buffer
|
||||||
gl_BindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo_read);
|
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) {
|
if (GLState::blend) {
|
||||||
glDisable(GL_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);
|
OMSetRenderTargets(NULL, ds, &GLState::scissor);
|
||||||
OMSetColorMaskState(); // TODO: likely useless
|
|
||||||
|
|
||||||
// ia
|
// 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)
|
void GSDeviceOGL::OMSetDepthStencilState(GSDepthStencilOGL* dss)
|
||||||
{
|
{
|
||||||
dss->SetupDepth();
|
dss->SetupDepth();
|
||||||
|
@ -1394,10 +1392,8 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto
|
||||||
if (rt == NULL || !RT->IsBackbuffer()) {
|
if (rt == NULL || !RT->IsBackbuffer()) {
|
||||||
OMSetFBO(m_fbo);
|
OMSetFBO(m_fbo);
|
||||||
if (rt) {
|
if (rt) {
|
||||||
OMSetWriteBuffer();
|
|
||||||
OMAttachRt(RT);
|
OMAttachRt(RT);
|
||||||
} else {
|
} else {
|
||||||
OMSetWriteBuffer(GL_NONE);
|
|
||||||
OMAttachRt();
|
OMAttachRt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,6 @@ class GSDeviceOGL : public GSDevice
|
||||||
void OMSetDepthStencilState(GSDepthStencilOGL* dss);
|
void OMSetDepthStencilState(GSDepthStencilOGL* dss);
|
||||||
void OMSetBlendState(uint8 blend_index = 0, uint8 blend_factor = 0, bool is_blend_constant = false);
|
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 OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4i* scissor = NULL);
|
||||||
void OMSetWriteBuffer(GLenum buffer = GL_COLOR_ATTACHMENT0);
|
|
||||||
void OMSetColorMaskState(OMColorMaskSelector sel = OMColorMaskSelector());
|
void OMSetColorMaskState(OMColorMaskSelector sel = OMColorMaskSelector());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -906,13 +906,11 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
// Don't write anything on the color buffer
|
// Don't write anything on the color buffer
|
||||||
// Neither in the depth buffer
|
// Neither in the depth buffer
|
||||||
dev->OMSetWriteBuffer(GL_NONE);
|
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
// Compute primitiveID max that pass the date test
|
// Compute primitiveID max that pass the date test
|
||||||
SendDraw(false);
|
SendDraw(false);
|
||||||
|
|
||||||
// Ask PS to discard shader above the primitiveID max
|
// Ask PS to discard shader above the primitiveID max
|
||||||
dev->OMSetWriteBuffer();
|
|
||||||
glDepthMask(GLState::depth_mask);
|
glDepthMask(GLState::depth_mask);
|
||||||
|
|
||||||
ps_sel.date = 3;
|
ps_sel.date = 3;
|
||||||
|
|
Loading…
Reference in New Issue