radv: add radv_get_last_vgt_shader() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 23 Mar 2023 17:15:59 +0000 (18:15 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 29 Mar 2023 02:20:50 +0000 (02:20 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22095>

src/amd/vulkan/radv_pipeline.c

index ad4d544..ef0e42c 100644 (file)
@@ -1432,20 +1432,26 @@ radv_get_shader(const struct radv_pipeline *pipeline, gl_shader_stage stage)
    return pipeline->shaders[stage];
 }
 
-static const struct radv_vs_output_info *
-get_vs_output_info(const struct radv_graphics_pipeline *pipeline)
+static const struct radv_shader *
+radv_get_last_vgt_shader(const struct radv_graphics_pipeline *pipeline)
 {
    if (radv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY))
       if (radv_pipeline_has_ngg(pipeline))
-         return &pipeline->base.shaders[MESA_SHADER_GEOMETRY]->info.outinfo;
+         return pipeline->base.shaders[MESA_SHADER_GEOMETRY];
       else
-         return &pipeline->base.gs_copy_shader->info.outinfo;
+         return pipeline->base.gs_copy_shader;
    else if (radv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_CTRL))
-      return &pipeline->base.shaders[MESA_SHADER_TESS_EVAL]->info.outinfo;
+      return pipeline->base.shaders[MESA_SHADER_TESS_EVAL];
    else if (radv_pipeline_has_stage(pipeline, MESA_SHADER_MESH))
-      return &pipeline->base.shaders[MESA_SHADER_MESH]->info.outinfo;
+      return pipeline->base.shaders[MESA_SHADER_MESH];
    else
-      return &pipeline->base.shaders[MESA_SHADER_VERTEX]->info.outinfo;
+      return pipeline->base.shaders[MESA_SHADER_VERTEX];
+}
+
+static const struct radv_vs_output_info *
+get_vs_output_info(const struct radv_graphics_pipeline *pipeline)
+{
+   return &radv_get_last_vgt_shader(pipeline)->info.outinfo;
 }
 
 static bool