mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 953221 - Disable glDrawBuffer/glReadBuffer when no color attachment. r=bjacob
This is mainly for OSX where the OGL version requires this so that the framebuffer complete checks pass.
This commit is contained in:
parent
1966c22b51
commit
e291e9fb5f
@ -206,6 +206,18 @@ WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer *wfb)
|
||||
|
||||
if (!wfb) {
|
||||
gl->fBindFramebuffer(target, 0);
|
||||
|
||||
// Restore draw/read buffers when switching back to default
|
||||
// render target.
|
||||
GLint drawBuffer = LOCAL_GL_COLOR_ATTACHMENT0;
|
||||
gl->fGetIntegerv(LOCAL_GL_DRAW_BUFFER, &drawBuffer);
|
||||
if (drawBuffer == LOCAL_GL_NONE)
|
||||
gl->fDrawBuffer(LOCAL_GL_COLOR_ATTACHMENT0);
|
||||
|
||||
GLint readBuffer = LOCAL_GL_COLOR_ATTACHMENT0;
|
||||
gl->fGetIntegerv(LOCAL_GL_READ_BUFFER, &readBuffer);
|
||||
if (readBuffer == LOCAL_GL_NONE)
|
||||
gl->fReadBuffer(LOCAL_GL_COLOR_ATTACHMENT0);
|
||||
} else {
|
||||
GLuint framebuffername = wfb->GLName();
|
||||
gl->fBindFramebuffer(target, framebuffername);
|
||||
|
@ -727,6 +727,11 @@ WebGLFramebuffer::FinalizeAttachments() const
|
||||
ColorAttachment(i).FinalizeAttachment(LOCAL_GL_COLOR_ATTACHMENT0 + i);
|
||||
}
|
||||
|
||||
GLenum colorBufferSource =
|
||||
ColorAttachment(0).IsDefined() ? LOCAL_GL_COLOR_ATTACHMENT0 : LOCAL_GL_NONE;
|
||||
mContext->gl->fDrawBuffer(colorBufferSource);
|
||||
mContext->gl->fReadBuffer(colorBufferSource);
|
||||
|
||||
if (DepthAttachment().IsDefined())
|
||||
DepthAttachment().FinalizeAttachment(LOCAL_GL_DEPTH_ATTACHMENT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user