From 94706601fa2f52605d6e488f30fad9a0e2440612 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Wed, 6 Apr 2022 14:15:50 +0200 Subject: [PATCH] radv: Disable NGG for GS with suboptimal output vertex count. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When GS has a lot of output vertices: In this case, the occupancy of NGG GS is very low because API GS invocations can't even occupy a single Wave32 wave. Therefore the legacy pipeline performs better here. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260 Signed-off-by: Timur Kristóf Reviewed-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_pipeline.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 803a20c..0a955a6 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -3207,6 +3207,19 @@ radv_fill_shader_info(struct radv_pipeline *pipeline, infos[MESA_SHADER_TESS_EVAL].is_ngg = false; } + if (nir[MESA_SHADER_GEOMETRY] && + nir[MESA_SHADER_GEOMETRY]->info.gs.vertices_out >= 9) { + /* GS has suboptimal number of output vertices. In this case, + * the occupancy of NGG GS is very low, and API GS invocations + * can't even occupy a single Wave32 wave. + * Therefore the legacy pipeline performs better here. + */ + if (nir[MESA_SHADER_TESS_EVAL]) + infos[MESA_SHADER_TESS_EVAL].is_ngg = false; + else + infos[MESA_SHADER_VERTEX].is_ngg = false; + } + gl_shader_stage last_xfb_stage = MESA_SHADER_VERTEX; for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) { -- 2.7.4