tgsi_strings.c revision af69d88d
1/************************************************************************** 2 * 3 * Copyright 2007-2008 VMware, Inc. 4 * Copyright 2012 VMware, Inc. 5 * All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the 9 * "Software"), to deal in the Software without restriction, including 10 * without limitation the rights to use, copy, modify, merge, publish, 11 * distribute, sub license, and/or sell copies of the Software, and to 12 * permit persons to whom the Software is furnished to do so, subject to 13 * the following conditions: 14 * 15 * The above copyright notice and this permission notice (including the 16 * next paragraph) shall be included in all copies or substantial portions 17 * of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22 * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 * 27 **************************************************************************/ 28 29 30#include "pipe/p_compiler.h" 31#include "util/u_memory.h" 32#include "tgsi_strings.h" 33 34 35const char *tgsi_processor_type_names[4] = 36{ 37 "FRAG", 38 "VERT", 39 "GEOM", 40 "COMP" 41}; 42 43static const char *tgsi_file_names[] = 44{ 45 "NULL", 46 "CONST", 47 "IN", 48 "OUT", 49 "TEMP", 50 "SAMP", 51 "ADDR", 52 "IMM", 53 "PRED", 54 "SV", 55 "RES", 56 "SVIEW" 57}; 58 59const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = 60{ 61 "POSITION", 62 "COLOR", 63 "BCOLOR", 64 "FOG", 65 "PSIZE", 66 "GENERIC", 67 "NORMAL", 68 "FACE", 69 "EDGEFLAG", 70 "PRIM_ID", 71 "INSTANCEID", 72 "VERTEXID", 73 "STENCIL", 74 "CLIPDIST", 75 "CLIPVERTEX", 76 "GRID_SIZE", 77 "BLOCK_ID", 78 "BLOCK_SIZE", 79 "THREAD_ID", 80 "TEXCOORD", 81 "PCOORD", 82 "VIEWPORT_INDEX", 83 "LAYER", 84 "CULLDIST", 85 "SAMPLEID", 86 "SAMPLEPOS", 87 "SAMPLEMASK", 88 "INVOCATIONID", 89}; 90 91const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = 92{ 93 "BUFFER", 94 "1D", 95 "2D", 96 "3D", 97 "CUBE", 98 "RECT", 99 "SHADOW1D", 100 "SHADOW2D", 101 "SHADOWRECT", 102 "1D_ARRAY", 103 "2D_ARRAY", 104 "SHADOW1D_ARRAY", 105 "SHADOW2D_ARRAY", 106 "SHADOWCUBE", 107 "2D_MSAA", 108 "2D_ARRAY_MSAA", 109 "CUBEARRAY", 110 "SHADOWCUBEARRAY", 111 "UNKNOWN", 112}; 113 114const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = 115{ 116 "GS_INPUT_PRIMITIVE", 117 "GS_OUTPUT_PRIMITIVE", 118 "GS_MAX_OUTPUT_VERTICES", 119 "FS_COORD_ORIGIN", 120 "FS_COORD_PIXEL_CENTER", 121 "FS_COLOR0_WRITES_ALL_CBUFS", 122 "FS_DEPTH_LAYOUT", 123 "VS_PROHIBIT_UCPS", 124 "GS_INVOCATIONS", 125 "VS_POSITION_WINDOW_SPACE" 126}; 127 128const char *tgsi_type_names[5] = 129{ 130 "UNORM", 131 "SNORM", 132 "SINT", 133 "UINT", 134 "FLOAT" 135}; 136 137const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] = 138{ 139 "CONSTANT", 140 "LINEAR", 141 "PERSPECTIVE", 142 "COLOR" 143}; 144 145const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] = 146{ 147 "CENTER", 148 "CENTROID", 149 "SAMPLE", 150}; 151 152const char *tgsi_primitive_names[PIPE_PRIM_MAX] = 153{ 154 "POINTS", 155 "LINES", 156 "LINE_LOOP", 157 "LINE_STRIP", 158 "TRIANGLES", 159 "TRIANGLE_STRIP", 160 "TRIANGLE_FAN", 161 "QUADS", 162 "QUAD_STRIP", 163 "POLYGON", 164 "LINES_ADJACENCY", 165 "LINE_STRIP_ADJACENCY", 166 "TRIANGLES_ADJACENCY", 167 "TRIANGLE_STRIP_ADJACENCY" 168}; 169 170const char *tgsi_fs_coord_origin_names[2] = 171{ 172 "UPPER_LEFT", 173 "LOWER_LEFT" 174}; 175 176const char *tgsi_fs_coord_pixel_center_names[2] = 177{ 178 "HALF_INTEGER", 179 "INTEGER" 180}; 181 182const char *tgsi_immediate_type_names[3] = 183{ 184 "FLT32", 185 "UINT32", 186 "INT32" 187}; 188 189 190static INLINE void 191tgsi_strings_check(void) 192{ 193 STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT); 194 STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT); 195 STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT); 196 STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX); 197 STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT); 198 (void) tgsi_processor_type_names; 199 (void) tgsi_type_names; 200 (void) tgsi_immediate_type_names; 201 (void) tgsi_fs_coord_origin_names; 202 (void) tgsi_fs_coord_pixel_center_names; 203} 204 205 206const char * 207tgsi_file_name(unsigned file) 208{ 209 STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT); 210 if (file < Elements(tgsi_file_names)) 211 return tgsi_file_names[file]; 212 else 213 return "invalid file"; 214} 215