aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-01-16 18:32:47 -0800
committerBrian Paul <[email protected]>2014-01-21 10:53:51 -0800
commitb9f68d927ea5e114b6019c807ce65674d9fa1d1d (patch)
tree66516d8234dc8bbf843ddc500d047bbeed94964c /src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
parent384fd64ab1533df8256600733a1fc8413af3514a (diff)
svga: implement TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
Fixes several colorbuffer tests, including piglit "fbo-drawbuffers-none" for "gl_FragColor" and "glDrawPixels" cases. v2: rework patch to only avoid creating extra shader variants when TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS is not specified. Per Jose. Use a write_color0_to_n_cbufs key field to replicate color0 to N color buffers only when N > 0 and WRITES_ALL_CBUFS is set. Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_decl_sm30.c')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm30.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index e0a30a5248e..137afd60583 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -327,14 +327,35 @@ ps30_output(struct svga_shader_emitter *emit,
{
switch (semantic.Name) {
case TGSI_SEMANTIC_COLOR:
- if (emit->unit == PIPE_SHADER_FRAGMENT &&
- emit->key.fkey.white_fragments) {
-
- emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
- emit->nr_hw_temp++ );
- emit->temp_color_output[idx] = emit->output_map[idx];
- emit->true_color_output[idx] = dst_register(SVGA3DREG_COLOROUT,
- semantic.Index);
+ if (emit->unit == PIPE_SHADER_FRAGMENT) {
+ if (emit->key.fkey.white_fragments) {
+ /* Used for XOR logicop mode */
+ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
+ emit->nr_hw_temp++ );
+ emit->temp_color_output[idx] = emit->output_map[idx];
+ emit->true_color_output[idx] = dst_register(SVGA3DREG_COLOROUT,
+ semantic.Index);
+ }
+ else if (emit->key.fkey.write_color0_to_n_cbufs) {
+ /* We'll write color output [0] to all render targets.
+ * Prepare all the output registers here, but only when the
+ * semantic.Index == 0 so we don't do this more than once.
+ */
+ if (semantic.Index == 0) {
+ unsigned i;
+ for (i = 0; i < emit->key.fkey.write_color0_to_n_cbufs; i++) {
+ emit->output_map[i] = dst_register(SVGA3DREG_TEMP,
+ emit->nr_hw_temp++);
+ emit->temp_color_output[i] = emit->output_map[i];
+ emit->true_color_output[i] = dst_register(SVGA3DREG_COLOROUT,
+ i);
+ }
+ }
+ }
+ else {
+ emit->output_map[idx] =
+ dst_register(SVGA3DREG_COLOROUT, semantic.Index);
+ }
}
else {
emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT,