Mesa (gles3): mesa: Make ES3 glDrawBuffers() only accept BACK/ NONE for the winsys fbo.

Anuj Phogat aphogat at kemper.freedesktop.org
Fri Jan 11 06:59:41 UTC 2013


Module: Mesa
Branch: gles3
Commit: ab55344568323a8567f2ff94d815dad0ae139c82
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab55344568323a8567f2ff94d815dad0ae139c82

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Dec 18 13:26:04 2012 -0800

mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.

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) {




More information about the mesa-commit mailing list