radv: determine as_ls/as_es in radv_link_shaders_info()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 26 Aug 2022 12:42:05 +0000 (14:42 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 17:02:17 +0000 (17:02 +0000)
This is a link shader info step somehow.

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/18278>

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

index 67f03f7..71b3580 100644 (file)
@@ -2802,17 +2802,6 @@ radv_fill_shader_info(struct radv_pipeline *pipeline,
 {
    struct radv_device *device = pipeline->device;
 
-   if (stages[MESA_SHADER_TESS_CTRL].nir) {
-      stages[MESA_SHADER_VERTEX].info.vs.as_ls = true;
-   }
-
-   if (stages[MESA_SHADER_GEOMETRY].nir) {
-      if (stages[MESA_SHADER_TESS_CTRL].nir)
-         stages[MESA_SHADER_TESS_EVAL].info.tes.as_es = true;
-      else
-         stages[MESA_SHADER_VERTEX].info.vs.as_es = true;
-   }
-
    for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
       if (!stages[i].nir)
          continue;
index 768e872..d61d439 100644 (file)
@@ -1268,9 +1268,17 @@ radv_link_shaders_info(struct radv_device *device,
 
    if (producer->stage == MESA_SHADER_VERTEX || producer->stage == MESA_SHADER_TESS_EVAL) {
       if (consumer->stage == MESA_SHADER_GEOMETRY) {
+         uint32_t num_outputs_written;
+
+         if (producer->stage == MESA_SHADER_TESS_EVAL) {
+            num_outputs_written = producer->info.tes.num_linked_outputs;
+            producer->info.tes.as_es = true;
+         } else {
+            num_outputs_written = producer->info.vs.num_linked_outputs;
+            producer->info.vs.as_es = true;
+         }
+
          /* Compute the ESGS item size for VS or TES as ES. */
-         uint32_t num_outputs_written = producer->stage == MESA_SHADER_TESS_EVAL
-            ? producer->info.tes.num_linked_outputs : producer->info.vs.num_linked_outputs;
          producer->info.esgs_itemsize = num_outputs_written * 16;
       }
 
@@ -1294,6 +1302,8 @@ radv_link_shaders_info(struct radv_device *device,
       struct radv_pipeline_stage *vs_stage = producer;
       struct radv_pipeline_stage *tcs_stage = consumer;
 
+      vs_stage->info.vs.as_ls = true;
+
       vs_stage->info.workgroup_size =
          ac_compute_lshs_workgroup_size(device->physical_device->rad_info.gfx_level,
                                         MESA_SHADER_VERTEX, tcs_stage->info.num_tess_patches,