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/es3proto@2115 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index f1c8efc..3eea2e2 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -9695,17 +9695,14 @@
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
@@ -9726,6 +9723,11 @@
{
framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]);
}
+
+ for (int colorAttachment = n; colorAttachment < (int)context->getMaximumRenderTargets(); colorAttachment++)
+ {
+ framebuffer->setDrawBufferState(colorAttachment, GL_NONE);
+ }
}
}
catch (std::bad_alloc&)