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

Author: Marek Olšák <[email protected]>
Date:   Sat Oct  4 20:44:23 2014 +0200

radeonsi: don't recompile shaders when changing nr_cbufs from 0 to 1

Both cases are equivalent.

Reviewed-by: Michel Dänzer <[email protected]>

---

 src/gallium/drivers/radeonsi/si_shader.c |    4 ++--
 src/gallium/drivers/radeonsi/si_shader.h |    2 +-
 src/gallium/drivers/radeonsi/si_state.c  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index c9e6792..5a47055 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1479,8 +1479,8 @@ static void si_llvm_emit_fs_epilogue(struct 
lp_build_tgsi_context * bld_base)
                                /* Handle FS_COLOR0_WRITES_ALL_CBUFS. */
                                if 
(shader->selector->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS] &&
                                     shader->output[i].sid == 0 &&
-                                   si_shader_ctx->shader->key.ps.nr_cbufs > 1) 
{
-                                       for (int c = 1; c < 
si_shader_ctx->shader->key.ps.nr_cbufs; c++) {
+                                   si_shader_ctx->shader->key.ps.last_cbuf > 
0) {
+                                       for (int c = 1; c <= 
si_shader_ctx->shader->key.ps.last_cbuf; c++) {
                                                
si_llvm_init_export_args_load(bld_base,
                                                                              
si_shader_ctx->radeon_bld.soa.outputs[index],
                                                                              
V_008DFC_SQ_EXP_MRT + c, args);
diff --git a/src/gallium/drivers/radeonsi/si_shader.h 
b/src/gallium/drivers/radeonsi/si_shader.h
index 76c29fe..8468e1a 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -134,7 +134,7 @@ struct si_shader_selector {
 union si_shader_key {
        struct {
                unsigned        export_16bpc:8;
-               unsigned        nr_cbufs:4;
+               unsigned        last_cbuf:3;
                unsigned        color_two_side:1;
                unsigned        alpha_func:3;
                unsigned        flatshade:1;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 6eec88e..0ef6d97 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2207,7 +2207,7 @@ static INLINE void si_shader_selector_key(struct 
pipe_context *ctx,
                }
        } else if (sel->type == PIPE_SHADER_FRAGMENT) {
                if 
(sel->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
-                       key->ps.nr_cbufs = sctx->framebuffer.state.nr_cbufs;
+                       key->ps.last_cbuf = 
MAX2(sctx->framebuffer.state.nr_cbufs, 1) - 1;
                key->ps.export_16bpc = sctx->framebuffer.export_16bpc;
 
                if (sctx->queued.named.rasterizer) {

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

Reply via email to