panfrost: Handle explicit primitive restart

Don't fall back. Passes piglit ./bin/primitive-restart on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8447>
This commit is contained in:
Alyssa Rosenzweig 2021-01-12 11:32:45 -05:00 committed by Marge Bot
parent afad13700a
commit 7a6a5f3fe1

View file

@ -330,6 +330,14 @@ panfrost_emit_primitive_size(struct panfrost_context *ctx,
} }
} }
static bool
panfrost_is_implicit_prim_restart(const struct pipe_draw_info *info)
{
unsigned implicit_index = (1 << (info->index_size * 8)) - 1;
bool implicit = info->restart_index == implicit_index;
return info->primitive_restart && implicit;
}
static void static void
panfrost_draw_emit_tiler(struct panfrost_batch *batch, panfrost_draw_emit_tiler(struct panfrost_batch *batch,
const struct pipe_draw_info *info, const struct pipe_draw_info *info,
@ -369,8 +377,13 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch,
else else
cfg.first_provoking_vertex = rast->flatshade_first; cfg.first_provoking_vertex = rast->flatshade_first;
if (info->primitive_restart) if (panfrost_is_implicit_prim_restart(info)) {
cfg.primitive_restart = MALI_PRIMITIVE_RESTART_IMPLICIT; cfg.primitive_restart = MALI_PRIMITIVE_RESTART_IMPLICIT;
} else if (info->primitive_restart) {
cfg.primitive_restart = MALI_PRIMITIVE_RESTART_EXPLICIT;
cfg.primitive_restart_index = info->restart_index;
}
cfg.job_task_split = 6; cfg.job_task_split = 6;
if (info->index_size) { if (info->index_size) {
@ -486,15 +499,6 @@ panfrost_draw_vbo(
int mode = info->mode; int mode = info->mode;
/* Fallback unsupported restart index */
unsigned primitive_index = (1 << (info->index_size * 8)) - 1;
if (info->primitive_restart && info->index_size
&& info->restart_index != primitive_index) {
util_draw_vbo_without_prim_restart(pipe, info, indirect, &draws[0]);
return;
}
/* Fallback for unsupported modes */ /* Fallback for unsupported modes */
assert(ctx->rasterizer != NULL); assert(ctx->rasterizer != NULL);