util/prim_restart: assert the index size at the start of the function

this lets it be removed from the macro loop

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10966>
This commit is contained in:
Mike Blumenkrantz 2021-05-21 05:49:30 -04:00 committed by Marge Bot
parent c129ede523
commit 5d54b64e6d

View file

@ -241,6 +241,16 @@ util_draw_vbo_without_prim_restart(struct pipe_context *context,
assert(info->index_size);
assert(info->primitive_restart);
switch (info->index_size) {
case 1:
case 2:
case 4:
break;
default:
assert(!"Bad index size");
return PIPE_ERROR_BAD_INPUT;
}
if (indirect_info && indirect_info->buffer) {
indirect = read_indirect_elements(context, indirect_info);
info_count = indirect.count;