From b653164973bbd3053d3b9ed37c4362af96346900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 24 Sep 2021 15:54:03 +0200 Subject: [PATCH] radv: Fix gs_vgpr_comp_cnt for NGG culling in vertex shaders. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously these shaders always took the path to gs_vgpr_comp_cnt=3, but now they are 0 when they don't use primitive id. Fixes: 7ad69e2f7ee10c0e7afc302b9324e7a320424dcb Signed-off-by: Timur Kristóf Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_shader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 43c364b9b9c..c0594c39c29 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1291,13 +1291,14 @@ radv_postprocess_config(const struct radv_device *device, const struct ac_shader } else unreachable("Unexpected ES shader stage"); + bool nggc = info->has_ngg_culling; /* Culling uses GS vertex offsets 0, 1, 2. */ bool tes_triangles = stage == MESA_SHADER_TESS_EVAL && info->tes.primitive_mode >= 4; /* GL_TRIANGLES */ if (info->uses_invocation_id) { gs_vgpr_comp_cnt = 3; /* VGPR3 contains InvocationID. */ } else if (info->uses_prim_id) { gs_vgpr_comp_cnt = 2; /* VGPR2 contains PrimitiveID. */ - } else if (info->gs.vertices_in >= 3 || tes_triangles) { + } else if (info->gs.vertices_in >= 3 || tes_triangles || nggc) { gs_vgpr_comp_cnt = 1; /* VGPR1 contains offsets 2, 3 */ } else { gs_vgpr_comp_cnt = 0; /* VGPR0 contains offsets 0, 1 */