summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-04-01 18:44:15 -0600
committerBrian Paul <brianp@vmware.com>2009-04-01 18:44:15 -0600
commit9cc79fc2dcdd8e21d9616cc65a931f1f5859fc30 (patch)
tree131cd0e28d27ac2257a64245350d7434743f6934 /src/mesa/swrast
parente4b27b4a69f28ca71944fef5f809023bed630a95 (diff)
swrast: fix glDrawBuffer(GL_FRONT_AND_BACK)
We weren't putting the right colors into the back buffer in this mode.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_span.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 15a783b236..08d725c5eb 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1403,11 +1403,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++) {