asahi: Skip draws if the scissor culls everything

We can't pack the scissor descriptor for these, and there would be no rendering
anyway, so detect this condition and skip the draw.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11084>
This commit is contained in:
Alyssa Rosenzweig 2021-05-31 01:28:25 +05:30 committed by Marge Bot
parent 861109e441
commit 6d9242e109

View file

@ -1190,6 +1190,15 @@ agx_index_buffer_ptr(struct agx_batch *batch,
}
}
static bool
agx_scissor_culls_everything(struct agx_context *ctx)
{
const struct pipe_scissor_state ss = ctx->scissor;
return ctx->rast->base.scissor &&
((ss.minx == ss.maxx) || (ss.miny == ss.maxy));
}
static void
agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
unsigned drawid_offset,
@ -1210,6 +1219,9 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
struct agx_context *ctx = agx_context(pctx);
struct agx_batch *batch = ctx->batch;
if (agx_scissor_culls_everything(ctx))
return;
/* TODO: masks */
ctx->batch->draw |= ~0;