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: 7ad69e2f7e
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13031>
This commit is contained in:
Timur Kristóf 2021-09-24 15:54:03 +02:00 committed by Marge Bot
parent 240e60ba76
commit b653164973

View file

@ -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 */