Module: Mesa Branch: main Commit: b653164973bbd3053d3b9ed37c4362af96346900 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b653164973bbd3053d3b9ed37c4362af96346900
Author: Timur Kristóf <[email protected]> Date: Fri Sep 24 15:54:03 2021 +0200 radv: Fix gs_vgpr_comp_cnt for NGG culling in vertex shaders. 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 <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13031> --- 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 */
