mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.
authorPaul Berry <stereotype441@gmail.com>
Wed, 19 Dec 2012 18:08:58 +0000 (10:08 -0800)
committerPaul Berry <stereotype441@gmail.com>
Thu, 20 Dec 2012 18:03:30 +0000 (10:03 -0800)
Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

    "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
    framebuffer, src must be one of the values listed in table 17.4,
    including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/buffers.c

index 76f0d4671a6ea3761a84ad8893ebbda59f975933..d10a5739479425e1729871d1c014f35bebd7e6a6 100644 (file)
@@ -532,8 +532,8 @@ _mesa_ReadBuffer(GLenum buffer)
    if (MESA_VERBOSE & VERBOSE_API)
       _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
 
-   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
-      /* This is legal for user-created framebuffer objects */
+   if (buffer == GL_NONE) {
+      /* This is legal--it means that no buffer should be bound for reading. */
       srcBuffer = -1;
    }
    else {