agx/nir_lower_gs: bound static topologies

don't bloat up shader info.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34661>
This commit is contained in:
Alyssa Rosenzweig 2025-04-22 14:31:46 -04:00 committed by Marge Bot
parent 9b1d771747
commit cb52aa58d6
2 changed files with 7 additions and 6 deletions

View file

@ -1361,12 +1361,13 @@ optimize_static_topology(struct agx_gs_info *info, nir_shader *gs)
* to bound this, but we want small serialized shader info structs. We assume
* that large static index buffers are rare and hence fall back to dynamic.
*/
for (unsigned i = 0; i < info->max_indices; ++i) {
if (ctx.topology[i] != ~0 && ctx.topology[i] >= 0xFF) {
info->shape = AGX_GS_SHAPE_DYNAMIC_INDEXED;
return;
}
if (info->max_indices >= ARRAY_SIZE(info->topology)) {
info->shape = AGX_GS_SHAPE_DYNAMIC_INDEXED;
return;
}
for (unsigned i = 0; i < info->max_indices; ++i) {
assert((ctx.topology[i] < 0xFF || ctx.topology[i] == ~0) && "small");
info->topology[i] = ctx.topology[i];
}

View file

@ -42,7 +42,7 @@ struct agx_gs_info {
enum agx_gs_shape shape;
/* Static topology used if shape = AGX_GS_SHAPE_STATIC_INDEXED */
uint8_t topology[384];
uint8_t topology[64];
};
bool agx_nir_lower_gs(struct nir_shader *gs, bool rasterizer_discard,