[Mesa-dev] [PATCH 2/7] mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.

Anuj Phogat anuj.phogat at gmail.com
Mon Jan 7 08:16:27 PST 2013


From: Kenneth Graunke <kenneth at whitecape.org>

Nothing was explicitly checking this.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/main/buffers.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index c241338..ad585cd 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -316,6 +316,16 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
    supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
    usedBufferMask = 0x0;
 
+   /* From the ES 3.0 specification, page 180:
+    * "If the GL is bound to the default framebuffer, then n must be 1
+    *  and the constant must be BACK or NONE."
+    */
+   if (_mesa_is_gles3(ctx) && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
+       (n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
+      return;
+   }
+
    /* complicated error checking... */
    for (output = 0; output < n; output++) {
       if (buffers[output] == GL_NONE) {
-- 
1.7.7.6



More information about the mesa-dev mailing list