st/mesa: remove trailing NULL colorbuffers
authorMarek Olšák <marek.olsak@amd.com>
Sun, 20 Apr 2014 01:41:47 +0000 (03:41 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 24 Apr 2014 23:33:12 +0000 (01:33 +0200)
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_atom_framebuffer.c

index eb5f783cecbd32733d34a03074311fc60a6fbdd9..b195c55b347e4fa8ee534433e9732615c2605fe1 100644 (file)
@@ -113,6 +113,12 @@ update_framebuffer_state( struct st_context *st )
       pipe_surface_reference(&framebuffer->cbufs[i], NULL);
    }
 
+   /* Remove trailing GL_NONE draw buffers. */
+   while (framebuffer->nr_cbufs &&
+          !framebuffer->cbufs[framebuffer->nr_cbufs-1]) {
+      framebuffer->nr_cbufs--;
+   }
+
    /*
     * Depth/Stencil renderbuffer/surface.
     */