From 14541dacab218cbe82310d999d44130ebc3f6526 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Jun 2013 09:46:40 -0600 Subject: tgsi: replace tgsi_file_names tgsi_file_names[] with tgsi_file_name() function This change came from the discovery that the STATIC_ASSERT to check that the number of register file strings didn't actually work. Similar changes could be made for the other string arrays in tgsi_string.c Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/tgsi/tgsi_strings.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/tgsi/tgsi_strings.c') diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index d8caae5a606..27856767877 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -40,7 +40,7 @@ const char *tgsi_processor_type_names[4] = "COMP" }; -const char *tgsi_file_names[TGSI_FILE_COUNT] = +static const char *tgsi_file_names[] = { "NULL", "CONST", @@ -176,7 +176,6 @@ const char *tgsi_immediate_type_names[3] = static INLINE void tgsi_strings_check(void) { - STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT); STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT); STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT); STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT); @@ -188,3 +187,14 @@ tgsi_strings_check(void) (void) tgsi_fs_coord_origin_names; (void) tgsi_fs_coord_pixel_center_names; } + + +const char * +tgsi_file_name(unsigned file) +{ + STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT); + if (file < Elements(tgsi_file_names)) + return tgsi_file_names[file]; + else + return "invalid file"; +} -- cgit v1.2.3