radv: remove vs_common_out:export_clip_dists
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 27 Sep 2021 13:11:15 +0000 (15:11 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Sep 2021 09:59:09 +0000 (09:59 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13085>

src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader_info.c

index 29e23bb..539f144 100644 (file)
@@ -2885,11 +2885,16 @@ radv_fill_shader_info(struct radv_pipeline *pipeline,
          }
       }
 
-      /* TODO: These are no longer used as keys we should refactor this */
-      keys[MESA_SHADER_VERTEX].vs_common_out.export_clip_dists =
-         !!infos[MESA_SHADER_FRAGMENT].ps.num_input_clips_culls;
-      keys[MESA_SHADER_TESS_EVAL].vs_common_out.export_clip_dists =
-         !!infos[MESA_SHADER_FRAGMENT].ps.num_input_clips_culls;
+      if (!!infos[MESA_SHADER_FRAGMENT].ps.num_input_clips_culls) {
+         if (pipeline->graphics.last_vgt_api_stage == MESA_SHADER_VERTEX) {
+            infos[MESA_SHADER_VERTEX].vs.outinfo.export_clip_dists = true;
+         } else if (pipeline->graphics.last_vgt_api_stage == MESA_SHADER_TESS_EVAL) {
+            infos[MESA_SHADER_TESS_EVAL].tes.outinfo.export_clip_dists = true;
+         } else {
+            assert(pipeline->graphics.last_vgt_api_stage == MESA_SHADER_GEOMETRY);
+            infos[MESA_SHADER_GEOMETRY].vs.outinfo.export_clip_dists = true;
+         }
+      }
 
       /* NGG passthrough mode can't be enabled for vertex shaders
        * that export the primitive ID.
index a6d2894..de1daa7 100644 (file)
@@ -603,24 +603,6 @@ 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;