<div dir="auto">R-b</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 26, 2019, 4:32 PM Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The only exception is the GS copy shader which emits them<br>
unconditionally.<br>
<br>
Totals from affected shaders:<br>
SGPRS: 71320 -> 71008 (-0.44 %)<br>
VGPRS: 54372 -> 54240 (-0.24 %)<br>
Code Size: 2952628 -> 2941368 (-0.38 %) bytes<br>
Max Waves: 9689 -> 9723 (0.35 %)<br>
<br>
This helps Dota2, Doom, GTAV and Hitman 2.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank" rel="noreferrer">samuel.pitoiset@gmail.com</a>><br>
---<br>
 src/amd/vulkan/radv_nir_to_llvm.c | 13 +++++++++----<br>
 src/amd/vulkan/radv_pipeline.c    |  4 ++++<br>
 src/amd/vulkan/radv_shader.h      |  2 ++<br>
 3 files changed, 15 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c<br>
index d6f286fe4ec..ead4e379a82 100644<br>
--- a/src/amd/vulkan/radv_nir_to_llvm.c<br>
+++ b/src/amd/vulkan/radv_nir_to_llvm.c<br>
@@ -2861,6 +2861,7 @@ radv_emit_streamout(struct radv_shader_context *ctx, unsigned stream)<br>
 static void<br>
 handle_vs_outputs_post(struct radv_shader_context *ctx,<br>
                       bool export_prim_id, bool export_layer_id,<br>
+                      bool export_clip_dists,<br>
                       struct radv_vs_output_info *outinfo)<br>
 {<br>
        uint32_t param_count = 0;<br>
@@ -2917,9 +2918,11 @@ handle_vs_outputs_post(struct radv_shader_context *ctx,<br>
                        memcpy(&pos_args[target - V_008DFC_SQ_EXP_POS],<br>
                        &args, sizeof(args));<br>
<br>
-                       /* Export the clip/cull distances values to the next stage. */<br>
-                       radv_export_param(ctx, param_count, &slots[0], 0xf);<br>
-                       outinfo->vs_output_param_offset[location] = param_count++;<br>
+                       if (export_clip_dists) {<br>
+                               /* Export the clip/cull distances values to the next stage. */<br>
+                               radv_export_param(ctx, param_count, &slots[0], 0xf);<br>
+                               outinfo->vs_output_param_offset[location] = param_count++;<br>
+                       }<br>
                }<br>
        }<br>
<br>
@@ -3446,6 +3449,7 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,<br>
                else<br>
                        handle_vs_outputs_post(ctx, ctx->options->key.vs.export_prim_id,<br>
                                               ctx->options->key.vs.export_layer_id,<br>
+                                              ctx->options->key.vs.export_clip_dists,<br>
                                               &ctx->shader_info->vs.outinfo);<br>
                break;<br>
        case MESA_SHADER_FRAGMENT:<br>
@@ -3463,6 +3467,7 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,<br>
                else<br>
                        handle_vs_outputs_post(ctx, ctx->options->key.tes.export_prim_id,<br>
                                               ctx->options->key.tes.export_layer_id,<br>
+                                              ctx->options->key.tes.export_clip_dists,<br>
                                               &ctx->shader_info->tes.outinfo);<br>
                break;<br>
        default:<br>
@@ -4117,7 +4122,7 @@ ac_gs_copy_shader_emit(struct radv_shader_context *ctx)<br>
                        radv_emit_streamout(ctx, stream);<br>
<br>
                if (stream == 0) {<br>
-                       handle_vs_outputs_post(ctx, false, false,<br>
+                       handle_vs_outputs_post(ctx, false, false, true,<br>
                                               &ctx->shader_info->vs.outinfo);<br>
                }<br>
<br>
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c<br>
index e61f9647596..985627be398 100644<br>
--- a/src/amd/vulkan/radv_pipeline.c<br>
+++ b/src/amd/vulkan/radv_pipeline.c<br>
@@ -2241,10 +2241,14 @@ void radv_create_shaders(struct radv_pipeline *pipeline,<br>
                        pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.prim_id_input;<br>
                keys[MESA_SHADER_VERTEX].vs.export_layer_id =<br>
                        pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.layer_input;<br>
+               keys[MESA_SHADER_VERTEX].vs.export_clip_dists =<br>
+                       !!pipeline->shaders[MESA_SHADER_FRAGMENT]-><a href="http://info.info" target="_blank" rel="noreferrer">info.info</a>.ps.num_input_clips_culls;<br>
                keys[MESA_SHADER_TESS_EVAL].tes.export_prim_id =<br>
                        pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.prim_id_input;<br>
                keys[MESA_SHADER_TESS_EVAL].tes.export_layer_id =<br>
                        pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.layer_input;<br>
+               keys[MESA_SHADER_TESS_EVAL].tes.export_clip_dists =<br>
+                       !!pipeline->shaders[MESA_SHADER_FRAGMENT]-><a href="http://info.info" target="_blank" rel="noreferrer">info.info</a>.ps.num_input_clips_culls;<br>
        }<br>
<br>
        if (device->physical_device->rad_info.chip_class >= GFX9 && modules[MESA_SHADER_TESS_CTRL]) {<br>
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h<br>
index bfd2787a123..17779cd0c42 100644<br>
--- a/src/amd/vulkan/radv_shader.h<br>
+++ b/src/amd/vulkan/radv_shader.h<br>
@@ -81,12 +81,14 @@ struct radv_vs_variant_key {<br>
        uint32_t as_ls:1;<br>
        uint32_t export_prim_id:1;<br>
        uint32_t export_layer_id:1;<br>
+       uint32_t export_clip_dists:1;<br>
 };<br>
<br>
 struct radv_tes_variant_key {<br>
        uint32_t as_es:1;<br>
        uint32_t export_prim_id:1;<br>
        uint32_t export_layer_id:1;<br>
+       uint32_t export_clip_dists:1;<br>
        uint8_t num_patches;<br>
        uint8_t tcs_num_outputs;<br>
 };<br>
-- <br>
2.22.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>