Module: Mesa
Branch: master
Commit: 7e86d9bd8c48626c9f2dbd8b96da055e329d5bc1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e86d9bd8c48626c9f2dbd8b96da055e329d5bc1

Author: Brian Paul <bri...@vmware.com>
Date:   Wed Jan 19 18:45:43 2011 -0700

llvmpipe: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=33284

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 1b9119e..6243a96 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -546,6 +546,7 @@ generate_fragment(struct llvmpipe_context *lp,
    unsigned i;
    unsigned chan;
    unsigned cbuf;
+   boolean cbuf0_write_all;
 
    /* Adjust color input interpolation according to flatshade state:
     */
@@ -559,6 +560,15 @@ generate_fragment(struct llvmpipe_context *lp,
       }
    }
 
+   /* check if writes to cbuf[0] are to be copied to all cbufs */
+   cbuf0_write_all = FALSE;
+   for (i = 0;i < shader->info.base.num_properties; i++) {
+      if (shader->info.base.properties[i].name ==
+          TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS) {
+         cbuf0_write_all = TRUE;
+         break;
+      }
+   }
 
    /* TODO: actually pick these based on the fs and color buffer
     * characteristics. */
@@ -697,9 +707,10 @@ generate_fragment(struct llvmpipe_context *lp,
                   mask_input,
                   counter);
 
-      for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++)
-        for(chan = 0; chan < NUM_CHANNELS; ++chan)
-           fs_out_color[cbuf][chan][i] = out_color[cbuf][chan];
+      for (cbuf = 0; cbuf < key->nr_cbufs; cbuf++)
+         for (chan = 0; chan < NUM_CHANNELS; ++chan)
+            fs_out_color[cbuf][chan][i] =
+               out_color[cbuf * !cbuf0_write_all][chan];
    }
 
    sampler->destroy(sampler);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to