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

Author: Marek Olšák <[email protected]>
Date:   Tue Sep  5 19:02:13 2017 +0200

radeonsi/gfx9: don't read LS out vertex stride from an SGPR in monolithic HS

-44 bytes in a monolithic LS-HS binary.

Tested-by: Dieter Nützel <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_shader.c        | 5 +++++
 src/gallium/drivers/radeonsi/si_state_shaders.c | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 362ee038e1..96ba907a08 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -408,6 +408,11 @@ static LLVMValueRef get_tcs_in_vertex_dw_stride(struct 
si_shader_context *ctx)
                return LLVMConstInt(ctx->i32, stride * 4, 0);
 
        case PIPE_SHADER_TESS_CTRL:
+               if (ctx->screen->b.chip_class >= GFX9 &&
+                   ctx->shader->is_monolithic) {
+                       stride = 
util_last_bit64(ctx->shader->key.part.tcs.ls->outputs_written);
+                       return LLVMConstInt(ctx->i32, stride * 4, 0);
+               }
                return unpack_param(ctx, ctx->param_vs_state_bits, 24, 8);
 
        default:
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index d8791a2a62..9f76551cfb 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1291,7 +1291,12 @@ static inline void si_shader_selector_key(struct 
pipe_context *ctx,
                         *  - remove the fixup for unused input VGPRs
                         */
                        key->part.tcs.ls_prolog.ls_vgpr_fix = sctx->ls_vgpr_fix;
-                       key->opt.prefer_mono = sctx->ls_vgpr_fix;
+
+                       /* The LS output / HS input layout can be communicated
+                        * directly instead of via user SGPRs for merged LS-HS.
+                        * The LS VGPR fix prefers this too.
+                        */
+                       key->opt.prefer_mono = 1;
                }
 
                key->part.tcs.epilog.prim_mode =

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

Reply via email to