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

Author: Marek Olšák <[email protected]>
Date:   Tue Aug 29 03:41:18 2017 +0200

radeonsi: eliminate PS color outputs when colormask kills them

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_state.c         | 4 ++++
 src/gallium/drivers/radeonsi/si_state.h         | 1 +
 src/gallium/drivers/radeonsi/si_state_shaders.c | 1 +
 3 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 41b08f8de4..5ee8bb9cd5 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -441,6 +441,8 @@ static void *si_create_blend_state_mode(struct pipe_context 
*ctx,
                blend->need_src_alpha_4bit |= 0xf;
 
        blend->cb_target_mask = 0;
+       blend->cb_target_enabled_4bit = 0;
+
        for (int i = 0; i < 8; i++) {
                /* state->rt entries > 0 only written if independent blending */
                const int j = state->independent_blend_enable ? i : 0;
@@ -482,6 +484,8 @@ static void *si_create_blend_state_mode(struct pipe_context 
*ctx,
 
                /* cb_render_state will disable unused ones */
                blend->cb_target_mask |= (unsigned)state->rt[j].colormask << (4 
* i);
+               if (state->rt[j].colormask)
+                       blend->cb_target_enabled_4bit |= 0xf << (4 * i);
 
                if (!state->rt[j].colormask || !state->rt[j].blend_enable) {
                        si_pm4_set_reg(pm4, R_028780_CB_BLEND0_CONTROL + i * 4, 
blend_cntl);
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 26c7b4ca9a..7b7d96c066 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -55,6 +55,7 @@ struct si_state_blend {
        /* Set 0xf or 0x0 (4 bits) per render target if the following is
         * true. ANDed with spi_shader_col_format.
         */
+       unsigned                cb_target_enabled_4bit;
        unsigned                blend_enable_4bit;
        unsigned                need_src_alpha_4bit;
 };
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 71d798749c..061b3d213e 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1355,6 +1355,7 @@ 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);
+                       key->part.ps.epilog.spi_shader_col_format &= 
blend->cb_target_enabled_4bit;
 
                        /* The output for dual source blending should have
                         * the same format as the first output.

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to