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

Author: Samuel Pitoiset <[email protected]>
Date:   Fri Sep 24 13:55:10 2021 +0200

radv: add export_clip_dists for VS and TES to radv_shader_info

To be able to remove radv_vs_out_key entirely.

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13028>

---

 src/amd/vulkan/radv_shader.h      |  1 +
 src/amd/vulkan/radv_shader_info.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index e1e7cdad086..1afecc48135 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -214,6 +214,7 @@ struct radv_vs_output_info {
    bool writes_viewport_index;
    bool writes_primitive_shading_rate;
    bool export_prim_id;
+   bool export_clip_dists;
    unsigned pos_exports;
 };
 
diff --git a/src/amd/vulkan/radv_shader_info.c 
b/src/amd/vulkan/radv_shader_info.c
index 31ded5e304d..7c121a718f7 100644
--- a/src/amd/vulkan/radv_shader_info.c
+++ b/src/amd/vulkan/radv_shader_info.c
@@ -654,6 +654,23 @@ radv_nir_shader_info_pass(struct radv_device *device, 
const struct nir_shader *n
       }
    }
 
+   /* Make sure to export the clip/cull distances if the fragment shader needs 
it. */
+   if (key->vs_common_out.export_clip_dists) {
+      switch (nir->info.stage) {
+      case MESA_SHADER_VERTEX:
+         info->vs.outinfo.export_clip_dists = true;
+         break;
+      case MESA_SHADER_TESS_EVAL:
+         info->tes.outinfo.export_clip_dists = true;
+         break;
+      case MESA_SHADER_GEOMETRY:
+         info->vs.outinfo.export_clip_dists = true;
+         break;
+      default:
+         break;
+      }
+   }
+
    if (nir->info.stage == MESA_SHADER_FRAGMENT)
       info->ps.num_interp = nir->num_inputs;
 

Reply via email to