fc29a2398aacd14f5997fc267de32eea684a391d
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_strings.c
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
35 const char *tgsi_processor_type_names[6] =
36 {
37 "FRAG",
38 "VERT",
39 "GEOM",
40 "TESS_CTRL",
41 "TESS_EVAL",
42 "COMP"
43 };
44
45 static const char *tgsi_file_names[] =
46 {
47 "NULL",
48 "CONST",
49 "IN",
50 "OUT",
51 "TEMP",
52 "SAMP",
53 "ADDR",
54 "IMM",
55 "PRED",
56 "SV",
57 "RES",
58 "SVIEW"
59 };
60
61 const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
62 {
63 "POSITION",
64 "COLOR",
65 "BCOLOR",
66 "FOG",
67 "PSIZE",
68 "GENERIC",
69 "NORMAL",
70 "FACE",
71 "EDGEFLAG",
72 "PRIM_ID",
73 "INSTANCEID",
74 "VERTEXID",
75 "STENCIL",
76 "CLIPDIST",
77 "CLIPVERTEX",
78 "GRID_SIZE",
79 "BLOCK_ID",
80 "BLOCK_SIZE",
81 "THREAD_ID",
82 "TEXCOORD",
83 "PCOORD",
84 "VIEWPORT_INDEX",
85 "LAYER",
86 "CULLDIST",
87 "SAMPLEID",
88 "SAMPLEPOS",
89 "SAMPLEMASK",
90 "INVOCATIONID",
91 "VERTEXID_NOBASE",
92 "BASEVERTEX",
93 "PATCH",
94 "TESSCOORD",
95 "TESSOUTER",
96 "TESSINNER",
97 "VERTICESIN",
98 "HELPER_INVOCATION",
99 };
100
101 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
102 {
103 "BUFFER",
104 "1D",
105 "2D",
106 "3D",
107 "CUBE",
108 "RECT",
109 "SHADOW1D",
110 "SHADOW2D",
111 "SHADOWRECT",
112 "1D_ARRAY",
113 "2D_ARRAY",
114 "SHADOW1D_ARRAY",
115 "SHADOW2D_ARRAY",
116 "SHADOWCUBE",
117 "2D_MSAA",
118 "2D_ARRAY_MSAA",
119 "CUBEARRAY",
120 "SHADOWCUBEARRAY",
121 "UNKNOWN",
122 };
123
124 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
125 {
126 "GS_INPUT_PRIMITIVE",
127 "GS_OUTPUT_PRIMITIVE",
128 "GS_MAX_OUTPUT_VERTICES",
129 "FS_COORD_ORIGIN",
130 "FS_COORD_PIXEL_CENTER",
131 "FS_COLOR0_WRITES_ALL_CBUFS",
132 "FS_DEPTH_LAYOUT",
133 "VS_PROHIBIT_UCPS",
134 "GS_INVOCATIONS",
135 "VS_WINDOW_SPACE_POSITION",
136 "TCS_VERTICES_OUT",
137 "TES_PRIM_MODE",
138 "TES_SPACING",
139 "TES_VERTEX_ORDER_CW",
140 "TES_POINT_MODE",
141 "NUM_CLIPDIST_ENABLED",
142 "NUM_CULLDIST_ENABLED",
143 };
144
145 const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
146 {
147 "UNORM",
148 "SNORM",
149 "SINT",
150 "UINT",
151 "FLOAT"
152 };
153
154 const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
155 {
156 "CONSTANT",
157 "LINEAR",
158 "PERSPECTIVE",
159 "COLOR"
160 };
161
162 const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
163 {
164 "CENTER",
165 "CENTROID",
166 "SAMPLE",
167 };
168
169 const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
170 {
171 "POINTS",
172 "LINES",
173 "LINE_LOOP",
174 "LINE_STRIP",
175 "TRIANGLES",
176 "TRIANGLE_STRIP",
177 "TRIANGLE_FAN",
178 "QUADS",
179 "QUAD_STRIP",
180 "POLYGON",
181 "LINES_ADJACENCY",
182 "LINE_STRIP_ADJACENCY",
183 "TRIANGLES_ADJACENCY",
184 "TRIANGLE_STRIP_ADJACENCY",
185 "PATCHES",
186 };
187
188 const char *tgsi_fs_coord_origin_names[2] =
189 {
190 "UPPER_LEFT",
191 "LOWER_LEFT"
192 };
193
194 const char *tgsi_fs_coord_pixel_center_names[2] =
195 {
196 "HALF_INTEGER",
197 "INTEGER"
198 };
199
200 const char *tgsi_immediate_type_names[4] =
201 {
202 "FLT32",
203 "UINT32",
204 "INT32",
205 "FLT64"
206 };
207
208
209 static inline void
210 tgsi_strings_check(void)
211 {
212 STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
213 STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
214 STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
215 STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
216 STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
217 STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
218 (void) tgsi_processor_type_names;
219 (void) tgsi_return_type_names;
220 (void) tgsi_immediate_type_names;
221 (void) tgsi_fs_coord_origin_names;
222 (void) tgsi_fs_coord_pixel_center_names;
223 }
224
225
226 const char *
227 tgsi_file_name(unsigned file)
228 {
229 STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT);
230 if (file < Elements(tgsi_file_names))
231 return tgsi_file_names[file];
232 else
233 return "invalid file";
234 }