Mesa (mesa_7_4_branch): swrast: fix glDrawBuffer(GL_FRONT_AND_BACK)

Brian Paul brianp at kemper.freedesktop.org
Thu Apr 2 19:12:07 UTC 2009


Module: Mesa
Branch: mesa_7_4_branch
Commit: 7511d76bd7240b85bdbcda6b955a029ab3b04046
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7511d76bd7240b85bdbcda6b955a029ab3b04046

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Apr  2 13:07:53 2009 -0600

swrast: fix glDrawBuffer(GL_FRONT_AND_BACK)

We weren't putting the right colors into the back buffer in this mode.

(cherry picked from master, commit 9cc79fc2dcdd8e21d9616cc65a931f1f5859fc30)

---

 src/mesa/swrast/s_span.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index e36c1a4..f07014f 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1399,11 +1399,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
    }
 
    /*
-    * Write to renderbuffers
+    * Write to renderbuffers.
+    * Depending on glDrawBuffer() state and the which color outputs are
+    * written by the fragment shader, we may either replicate one color to
+    * all renderbuffers or write a different color to each renderbuffer.
+    * multiFragOutputs=TRUE for the later case.
     */
    {
       const GLuint numBuffers = fb->_NumColorDrawBuffers;
-      const GLboolean multiFragOutputs = numBuffers > 1;
+      const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+      const GLboolean multiFragOutputs = 
+         (fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
       GLuint buf;
 
       for (buf = 0; buf < numBuffers; buf++) {




More information about the mesa-commit mailing list