diff options
author | Brian Paul <[email protected]> | 2012-01-05 08:30:00 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-01-05 09:01:43 -0700 |
commit | 85b5dac705fcf3fafb734696e1f863cfc21e2d6e (patch) | |
tree | fe4596433fca3a13756e90a94aa57ac0a8bc8235 /src/gallium/auxiliary/tgsi/tgsi_dump.c | |
parent | 188aca34923d109323e0e1a882c69f2b422b5cae (diff) |
tgsi: consolidate TGSI string arrays in new tgsi_strings.h
There was some duplication between the tgsi_dump.c and tgsi_text.c
files. Also use some static assertions to help catch errors when
adding new TGSI values.
v2: put strings in tgsi_strings.c file instead of the .h file.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_dump.c')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_dump.c | 139 |
1 files changed, 5 insertions, 134 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index e830aa53f20..99634457ecd 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -32,6 +32,7 @@ #include "tgsi_dump.h" #include "tgsi_info.h" #include "tgsi_iterate.h" +#include "tgsi_strings.h" /** Number of spaces to indent for IF/LOOP/etc */ @@ -83,62 +84,6 @@ dump_enum( #define FLT(F) ctx->printf( ctx, "%10.4f", F ) #define ENM(E,ENUMS) dump_enum( ctx, E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) ) -static const char *processor_type_names[] = -{ - "FRAG", - "VERT", - "GEOM" -}; - -const char * -tgsi_file_names[TGSI_FILE_COUNT] = -{ - "NULL", - "CONST", - "IN", - "OUT", - "TEMP", - "SAMP", - "ADDR", - "IMM", - "PRED", - "SV", - "IMMX", - "TEMPX", - "RES" -}; - -static const char *interpolate_names[] = -{ - "CONSTANT", - "LINEAR", - "PERSPECTIVE" -}; - -static const char *semantic_names[] = -{ - "POSITION", - "COLOR", - "BCOLOR", - "FOG", - "PSIZE", - "GENERIC", - "NORMAL", - "FACE", - "EDGEFLAG", - "PRIM_ID", - "INSTANCEID", - "VERTEXID", - "STENCIL" -}; - -static const char *immediate_type_names[] = -{ - "FLT32", - "UINT32", - "INT32" -}; - const char * tgsi_swizzle_names[4] = { @@ -148,75 +93,6 @@ tgsi_swizzle_names[4] = "w" }; -const char * -tgsi_texture_names[TGSI_TEXTURE_COUNT] = -{ - "UNKNOWN", - "1D", - "2D", - "3D", - "CUBE", - "RECT", - "SHADOW1D", - "SHADOW2D", - "SHADOWRECT", - "1DARRAY", - "2DARRAY", - "SHADOW1DARRAY", - "SHADOW2DARRAY", -}; - -const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = -{ - "GS_INPUT_PRIMITIVE", - "GS_OUTPUT_PRIMITIVE", - "GS_MAX_OUTPUT_VERTICES", - "FS_COORD_ORIGIN", - "FS_COORD_PIXEL_CENTER", - "FS_COLOR0_WRITES_ALL_CBUFS", - "FS_DEPTH_LAYOUT" -}; - -static const char *tgsi_type_names[] = -{ - "UNORM", - "SNORM", - "SINT", - "UINT", - "FLOAT" -}; - -const char *tgsi_primitive_names[PIPE_PRIM_MAX] = -{ - "POINTS", - "LINES", - "LINE_LOOP", - "LINE_STRIP", - "TRIANGLES", - "TRIANGLE_STRIP", - "TRIANGLE_FAN", - "QUADS", - "QUAD_STRIP", - "POLYGON", - "LINES_ADJACENCY", - "LINE_STRIP_ADJACENCY", - "TRIANGLES_ADJACENCY", - "TRIANGLE_STRIP_ADJACENCY" -}; - -const char *tgsi_fs_coord_origin_names[2] = -{ - "UPPER_LEFT", - "LOWER_LEFT" -}; - -const char *tgsi_fs_coord_pixel_center_names[2] = -{ - "HALF_INTEGER", - "INTEGER" -}; - - static void _dump_register_src( struct dump_ctx *ctx, @@ -367,9 +243,6 @@ iter_declaration( { struct dump_ctx *ctx = (struct dump_ctx *)iter; - assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT); - assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT); - TXT( "DCL " ); ENM(decl->Declaration.File, tgsi_file_names); @@ -400,7 +273,7 @@ iter_declaration( if (decl->Declaration.Semantic) { TXT( ", " ); - ENM( decl->Semantic.Name, semantic_names ); + ENM( decl->Semantic.Name, tgsi_semantic_names ); if (decl->Semantic.Index != 0 || decl->Semantic.Name == TGSI_SEMANTIC_GENERIC) { CHR( '[' ); @@ -433,7 +306,7 @@ iter_declaration( decl->Declaration.File == TGSI_FILE_INPUT) { TXT( ", " ); - ENM( decl->Declaration.Interpolate, interpolate_names ); + ENM( decl->Declaration.Interpolate, tgsi_interpolate_names ); } if (decl->Declaration.Centroid) { @@ -521,8 +394,6 @@ iter_property( int i; struct dump_ctx *ctx = (struct dump_ctx *)iter; - assert(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT); - TXT( "PROPERTY " ); ENM(prop->Property.PropertyName, tgsi_property_names); @@ -571,7 +442,7 @@ iter_immediate( struct dump_ctx *ctx = (struct dump_ctx *) iter; TXT( "IMM " ); - ENM( imm->Immediate.DataType, immediate_type_names ); + ENM( imm->Immediate.DataType, tgsi_immediate_type_names ); dump_imm_data(iter, imm->u, imm->Immediate.NrTokens - 1, imm->Immediate.DataType); @@ -753,7 +624,7 @@ prolog( struct tgsi_iterate_context *iter ) { struct dump_ctx *ctx = (struct dump_ctx *) iter; - ENM( iter->processor.Processor, processor_type_names ); + ENM( iter->processor.Processor, tgsi_processor_type_names ); EOL(); return TRUE; } |