util/format: Use an explicit length for the descs

The script that generates the format tables does not set every pipe_format.
In practice, the length of the format tables is equal to PIPE_FORMAT_COUNT.
I just added the explicit size to future-proof it.

(If the largest valid format is not part of the format tables,
 there will be a mismatch between the array length and PIPE_FORMAT_COUNT)

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17490>
This commit is contained in:
Konstantin Seurer 2022-07-12 13:38:42 +02:00 committed by Marge Bot
parent 85e859ac5f
commit 2b02ac2779
1 changed files with 4 additions and 4 deletions

View File

@ -198,7 +198,7 @@ def write_format_table(formats):
print()
print('static const struct util_format_description')
print('util_format_descriptions[] = {')
print('util_format_descriptions[PIPE_FORMAT_COUNT] = {')
for format in formats:
sn = format.short_name()
@ -224,7 +224,7 @@ def write_format_table(formats):
generate_table_getter("")
print('static const struct util_format_pack_description')
print('util_format_pack_descriptions[] = {')
print('util_format_pack_descriptions[PIPE_FORMAT_COUNT] = {')
for format in formats:
sn = format.short_name()
@ -253,7 +253,7 @@ def write_format_table(formats):
print()
generate_table_getter("pack_")
print('static const struct util_format_unpack_description')
print('util_format_unpack_descriptions[] = {')
print('util_format_unpack_descriptions[PIPE_FORMAT_COUNT] = {')
for format in formats:
sn = format.short_name()
@ -293,7 +293,7 @@ def write_format_table(formats):
generate_table_getter("unpack_")
print('static const util_format_fetch_rgba_func_ptr util_format_fetch_rgba_table[] = {')
print('static const util_format_fetch_rgba_func_ptr util_format_fetch_rgba_table[PIPE_FORMAT_COUNT] = {')
for format in formats:
sn = format.short_name()