mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
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 <jfonseca@vmware.com>
This commit is contained in:
parent
97d641eb22
commit
14541dacab
7 changed files with 30 additions and 18 deletions
|
|
@ -433,7 +433,7 @@ dump_info(const struct tgsi_token *tokens,
|
|||
&tex_info->coord[chan];
|
||||
if (chan_info->file != TGSI_FILE_NULL) {
|
||||
debug_printf(" %s[%u].%c",
|
||||
tgsi_file_names[chan_info->file],
|
||||
tgsi_file_name(chan_info->file),
|
||||
chan_info->u.index,
|
||||
"xyzw01"[chan_info->swizzle]);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ _dump_register_src(
|
|||
struct dump_ctx *ctx,
|
||||
const struct tgsi_full_src_register *src )
|
||||
{
|
||||
ENM(src->Register.File, tgsi_file_names);
|
||||
TXT(tgsi_file_name(src->Register.File));
|
||||
if (src->Register.Dimension) {
|
||||
if (src->Dimension.Indirect) {
|
||||
CHR( '[' );
|
||||
ENM( src->DimIndirect.File, tgsi_file_names );
|
||||
TXT(tgsi_file_name(src->DimIndirect.File));
|
||||
CHR( '[' );
|
||||
SID( src->DimIndirect.Index );
|
||||
TXT( "]." );
|
||||
|
|
@ -127,7 +127,7 @@ _dump_register_src(
|
|||
}
|
||||
if (src->Register.Indirect) {
|
||||
CHR( '[' );
|
||||
ENM( src->Indirect.File, tgsi_file_names );
|
||||
TXT(tgsi_file_name(src->Indirect.File));
|
||||
CHR( '[' );
|
||||
SID( src->Indirect.Index );
|
||||
TXT( "]." );
|
||||
|
|
@ -156,11 +156,11 @@ _dump_register_dst(
|
|||
struct dump_ctx *ctx,
|
||||
const struct tgsi_full_dst_register *dst )
|
||||
{
|
||||
ENM(dst->Register.File, tgsi_file_names);
|
||||
TXT(tgsi_file_name(dst->Register.File));
|
||||
if (dst->Register.Dimension) {
|
||||
if (dst->Dimension.Indirect) {
|
||||
CHR( '[' );
|
||||
ENM( dst->DimIndirect.File, tgsi_file_names );
|
||||
TXT(tgsi_file_name(dst->DimIndirect.File));
|
||||
CHR( '[' );
|
||||
SID( dst->DimIndirect.Index );
|
||||
TXT( "]." );
|
||||
|
|
@ -184,7 +184,7 @@ _dump_register_dst(
|
|||
}
|
||||
if (dst->Register.Indirect) {
|
||||
CHR( '[' );
|
||||
ENM( dst->Indirect.File, tgsi_file_names );
|
||||
TXT(tgsi_file_name(dst->Indirect.File));
|
||||
CHR( '[' );
|
||||
SID( dst->Indirect.Index );
|
||||
TXT( "]." );
|
||||
|
|
@ -266,7 +266,7 @@ iter_declaration(
|
|||
|
||||
TXT( "DCL " );
|
||||
|
||||
ENM(decl->Declaration.File, tgsi_file_names);
|
||||
TXT(tgsi_file_name(decl->Declaration.File));
|
||||
|
||||
/* all geometry shader inputs are two dimensional */
|
||||
if (decl->Declaration.File == TGSI_FILE_INPUT &&
|
||||
|
|
@ -576,7 +576,7 @@ iter_instruction(
|
|||
ENM( inst->Texture.Texture, tgsi_texture_names );
|
||||
for (i = 0; i < inst->Texture.NumOffsets; i++) {
|
||||
TXT( ", " );
|
||||
ENM( inst->TexOffsets[i].File, tgsi_file_names);
|
||||
TXT(tgsi_file_name(inst->TexOffsets[i].File));
|
||||
CHR( '[' );
|
||||
SID( inst->TexOffsets[i].Index );
|
||||
CHR( ']' );
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ extern "C" {
|
|||
|
||||
extern const char *tgsi_processor_type_names[4];
|
||||
|
||||
extern const char *tgsi_file_names[TGSI_FILE_COUNT];
|
||||
|
||||
extern const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT];
|
||||
|
||||
extern const char *tgsi_texture_names[TGSI_TEXTURE_COUNT];
|
||||
|
|
@ -61,6 +59,10 @@ extern const char *tgsi_fs_coord_pixel_center_names[2];
|
|||
extern const char *tgsi_immediate_type_names[3];
|
||||
|
||||
|
||||
const char *
|
||||
tgsi_file_name(unsigned file);
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ parse_file( const char **pcur, uint *file )
|
|||
for (i = 0; i < TGSI_FILE_COUNT; i++) {
|
||||
const char *cur = *pcur;
|
||||
|
||||
if (str_match_nocase_whole( &cur, tgsi_file_names[i] )) {
|
||||
if (str_match_nocase_whole( &cur, tgsi_file_name(i) )) {
|
||||
*pcur = cur;
|
||||
*file = i;
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ add_dst_reg(struct fd_compile_context *ctx, struct ir2_instruction *alu,
|
|||
break;
|
||||
default:
|
||||
DBG("unsupported dst register file: %s",
|
||||
tgsi_file_names[dst->File]);
|
||||
tgsi_file_name(dst->File));
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ add_src_reg(struct fd_compile_context *ctx, struct ir2_instruction *alu,
|
|||
break;
|
||||
default:
|
||||
DBG("unsupported src register file: %s",
|
||||
tgsi_file_names[src->File]);
|
||||
tgsi_file_name(src->File));
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2565,11 +2565,11 @@ dump_reg_mapping(void *key, void *val, void *data)
|
|||
|
||||
if (tgsi_dim) {
|
||||
ilo_printf(" v%d:\t%s[%d][%d]\n", vrf,
|
||||
tgsi_file_names[tgsi_file], tgsi_dim, tgsi_index);
|
||||
tgsi_file_name(tgsi_file), tgsi_dim, tgsi_index);
|
||||
}
|
||||
else {
|
||||
ilo_printf(" v%d:\t%s[%d]\n", vrf,
|
||||
tgsi_file_names[tgsi_file], tgsi_index);
|
||||
tgsi_file_name(tgsi_file), tgsi_index);
|
||||
}
|
||||
|
||||
return PIPE_OK;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue