aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/tgsi/tgsi_strings.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-06-06 09:46:40 -0600
committerBrian Paul <[email protected]>2013-06-07 09:23:24 -0600
commit14541dacab218cbe82310d999d44130ebc3f6526 (patch)
tree1295e6f153bf8c3276f12ad51837bef67a4a81d4 /src/gallium/auxiliary/tgsi/tgsi_strings.c
parent97d641eb229e48cacc448eefb583381a27bd8af1 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_strings.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_strings.c14
1 files changed, 12 insertions, 2 deletions
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";
+}