radeonsi: eliminate PS OUT[1] if dual src blending is off and CB1 is not bound
authorMarek Olšák <marek.olsak@amd.com>
Wed, 10 Aug 2016 10:19:49 +0000 (12:19 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 17 Aug 2016 10:24:35 +0000 (12:24 +0200)
All VP DX9 ports benefit from this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 94dbe4c15b9f60d817a31243c0e01fceb71ded4b..5d554486cb78f8b29db8ae0f935c9ac603b4888b 100644 (file)
@@ -2350,17 +2350,6 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
                        vi_separate_dcc_start_query(ctx, rtex);
                }
        }
-       /* Set the second SPI format for possible dual-src blending. */
-       if (i == 1 && surf) {
-               sctx->framebuffer.spi_shader_col_format |=
-                       surf->spi_shader_col_format << (i * 4);
-               sctx->framebuffer.spi_shader_col_format_alpha |=
-                       surf->spi_shader_col_format_alpha << (i * 4);
-               sctx->framebuffer.spi_shader_col_format_blend |=
-                       surf->spi_shader_col_format_blend << (i * 4);
-               sctx->framebuffer.spi_shader_col_format_blend_alpha |=
-                       surf->spi_shader_col_format_blend_alpha << (i * 4);
-       }
 
        if (state->zsbuf) {
                surf = (struct r600_surface*)state->zsbuf;
index 87d0b7d9022e2e1d54b69eb2b74f2919b9162929..d82139745b9f2f5c6fc7c02aa859275b76d1398d 100644 (file)
@@ -900,6 +900,13 @@ static inline void si_shader_selector_key(struct pipe_context *ctx,
                                 sctx->framebuffer.spi_shader_col_format_alpha) |
                                (~blend->blend_enable_4bit & ~blend->need_src_alpha_4bit &
                                 sctx->framebuffer.spi_shader_col_format);
+
+                       /* The output for dual source blending should have
+                        * the same format as the first output.
+                        */
+                       if (blend->dual_src_blend)
+                               key->ps.epilog.spi_shader_col_format |=
+                                       (key->ps.epilog.spi_shader_col_format & 0xf) << 4;
                } else
                        key->ps.epilog.spi_shader_col_format = sctx->framebuffer.spi_shader_col_format;