asahi: Guard against encoder overflows

We don't seem to hit this yet, but it's possible so add an assert to
rule it out for failing tests.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16512>
This commit is contained in:
Alyssa Rosenzweig 2022-05-22 16:51:44 -04:00
parent 1d0d27aac7
commit d814711155

View file

@ -1626,6 +1626,9 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
(info->mode == PIPE_PRIM_LINE_STRIP) ||
(info->mode == PIPE_PRIM_LINE_LOOP);
ptrdiff_t encoder_use = batch->encoder_current - (uint8_t *) batch->encoder->ptr.cpu;
assert((encoder_use + 1024) < batch->encoder->size && "todo: how to expand encoder?");
uint8_t *out = agx_encode_state(ctx, batch->encoder_current,
agx_build_pipeline(ctx, ctx->vs, PIPE_SHADER_VERTEX),
agx_build_pipeline(ctx, ctx->fs, PIPE_SHADER_FRAGMENT),