Module: Mesa Branch: main Commit: 8b305ce32a083fb9489fe9ae0a721380e6e891a7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b305ce32a083fb9489fe9ae0a721380e6e891a7
Author: Alyssa Rosenzweig <[email protected]> Date: Thu May 20 16:43:51 2021 -0400 panfrost: Write translate_index_size better Encodings line up with Gallium except for uint32. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11074> --- src/gallium/drivers/panfrost/pan_context.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 7f3e1d37df0..b1857047dda 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -213,15 +213,14 @@ pan_emit_draw_descs(struct panfrost_batch *batch, d->samplers = batch->samplers[st]; } -static enum mali_index_type +static inline enum mali_index_type panfrost_translate_index_size(unsigned size) { - switch (size) { - case 1: return MALI_INDEX_TYPE_UINT8; - case 2: return MALI_INDEX_TYPE_UINT16; - case 4: return MALI_INDEX_TYPE_UINT32; - default: unreachable("Invalid index size"); - } + STATIC_ASSERT(MALI_INDEX_TYPE_NONE == 0); + STATIC_ASSERT(MALI_INDEX_TYPE_UINT8 == 1); + STATIC_ASSERT(MALI_INDEX_TYPE_UINT16 == 2); + + return (size == 4) ? MALI_INDEX_TYPE_UINT32 : size; } static void @@ -400,8 +399,9 @@ panfrost_draw_emit_tiler(struct panfrost_batch *batch, cfg.job_task_split = 6; cfg.index_count = ctx->indirect_draw ? 1 : draw->count; - if (info->index_size) { - cfg.index_type = panfrost_translate_index_size(info->index_size); + cfg.index_type = panfrost_translate_index_size(info->index_size); + + if (cfg.index_type) { cfg.indices = indices; cfg.base_vertex_offset = draw->index_bias - ctx->offset_start; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
