From 39c8562cf6c2375b1663aca24b8b07ca1029247f Mon Sep 17 00:00:00 2001 From: "shannon.woods%transgaming.com@gtempaccount.com" Date: Wed, 27 Mar 2013 16:06:19 +0000 Subject: [PATCH] Fix glDrawBuffersEXT to be compliant with the spec. Bind GL_NONE to buffers beyond the specified input count, and require a buffer count of one for the default framebuffer. TRAC #22835 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2039 736b8ea6-26fd-11df-bfd4-992fa37f6226 --- src/libGLESv2/libGLESv2.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp index 64f67d7d6..1e7cf9d0c 100644 --- a/src/libGLESv2/libGLESv2.cpp +++ b/src/libGLESv2/libGLESv2.cpp @@ -6977,17 +6977,14 @@ void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs) if (context->getDrawFramebufferHandle() == 0) { - if (n > 1) + if (n != 1) { return gl::error(GL_INVALID_OPERATION); } - if (n == 1) + if (bufs[0] != GL_NONE && bufs[0] != GL_BACK) { - if (bufs[0] != GL_NONE && bufs[0] != GL_BACK) - { - return gl::error(GL_INVALID_OPERATION); - } + return gl::error(GL_INVALID_OPERATION); } } else @@ -7008,6 +7005,11 @@ void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs) { framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); } + + for (int colorAttachment = n; colorAttachment < (int)context->getMaximumRenderTargets(); colorAttachment++) + { + framebuffer->setDrawBufferState(colorAttachment, GL_NONE); + } } } catch (std::bad_alloc&)