summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_state_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_fs.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 2c4943a69f..6243a96f45 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -90,7 +90,6 @@
#include "lp_context.h"
#include "lp_debug.h"
#include "lp_perf.h"
-#include "lp_screen.h"
#include "lp_setup.h"
#include "lp_state.h"
#include "lp_tex_sample.h"
@@ -335,7 +334,8 @@ generate_fs(struct gallivm_state *gallivm,
/* Build the actual shader */
lp_build_tgsi_soa(gallivm, tokens, type, &mask,
- consts_ptr, interp->pos, interp->inputs,
+ consts_ptr, NULL, /* sys values array */
+ interp->pos, interp->inputs,
outputs, sampler, &shader->info.base);
/* Alpha test */
@@ -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);