aco/ngg: fix division-by-zero in assertion

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-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/7576>
This commit is contained in:
Rhys Perry
2020-11-12 14:32:57 +00:00
committed by Marge Bot
parent 37a2c9ace6
commit 4eac442217
2 changed files with 28 additions and 1 deletions
@@ -416,7 +416,8 @@ void setup_gs_variables(isel_context *ctx, nir_shader *nir)
ctx->program->config->lds_size = (total_lds_bytes + ctx->program->lds_alloc_granule - 1) / ctx->program->lds_alloc_granule;
/* Make sure we have enough room for emitted GS vertices */
assert((ngg_emit_bytes % (ctx->ngg_gs_emit_vtx_bytes * nir->info.gs.vertices_out)) == 0);
if (nir->info.gs.vertices_out)
assert((ngg_emit_bytes % (ctx->ngg_gs_emit_vtx_bytes * nir->info.gs.vertices_out)) == 0);
/* See if the number of vertices and primitives are compile-time known */
nir_gs_count_vertices_and_primitives(nir, ctx->ngg_gs_const_vtxcnt, ctx->ngg_gs_const_prmcnt, 4u);