From 48fc29e0753014be5d6f52b7491ed0bb2614cbdf Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 26 Jul 2023 14:44:10 +0200 Subject: [PATCH] radv: use next_stage to determine if the layer should be exported More shader object friendly. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_graphics.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 0819a66..9c183e0 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -1195,16 +1195,15 @@ get_vs_output_info(const struct radv_graphics_pipeline *pipeline) } static bool -radv_should_export_multiview(const struct radv_shader_stage *producer, const struct radv_shader_stage *consumer, - const struct radv_pipeline_key *pipeline_key) +radv_should_export_multiview(const struct radv_shader_stage *stage, const struct radv_pipeline_key *pipeline_key) { /* Export the layer in the last VGT stage if multiview is used. When the next stage is unknown * (with graphics pipeline library), the layer is exported unconditionally. */ return pipeline_key->has_multiview_view_index && - ((consumer && consumer->stage == MESA_SHADER_FRAGMENT) || + (stage->info.next_stage == MESA_SHADER_FRAGMENT || !(pipeline_key->lib_flags & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT)) && - !(producer->nir->info.outputs_written & VARYING_BIT_LAYER); + !(stage->nir->info.outputs_written & VARYING_BIT_LAYER); } static void @@ -1439,7 +1438,7 @@ radv_link_vs(const struct radv_device *device, struct radv_shader_stage *vs_stag { assert(vs_stage->nir->info.stage == MESA_SHADER_VERTEX); - if (radv_should_export_multiview(vs_stage, next_stage, pipeline_key)) { + if (radv_should_export_multiview(vs_stage, pipeline_key)) { NIR_PASS(_, vs_stage->nir, radv_nir_export_multiview); } @@ -1509,7 +1508,7 @@ radv_link_tes(const struct radv_device *device, struct radv_shader_stage *tes_st { assert(tes_stage->nir->info.stage == MESA_SHADER_TESS_EVAL); - if (radv_should_export_multiview(tes_stage, next_stage, pipeline_key)) { + if (radv_should_export_multiview(tes_stage, pipeline_key)) { NIR_PASS(_, tes_stage->nir, radv_nir_export_multiview); } @@ -1541,7 +1540,7 @@ radv_link_gs(const struct radv_device *device, struct radv_shader_stage *gs_stag { assert(gs_stage->nir->info.stage == MESA_SHADER_GEOMETRY); - if (radv_should_export_multiview(gs_stage, fs_stage, pipeline_key)) { + if (radv_should_export_multiview(gs_stage, pipeline_key)) { NIR_PASS(_, gs_stage->nir, radv_nir_export_multiview); } -- 2.7.4