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 "VERT",
38 "FRAG",
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 "SV",
56 "IMAGE",
57 "SVIEW",
58 "BUFFER",
59 "MEMORY",
60 "CONSTBUF",
61 "HWATOMIC",
62 };
63
64 const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
65 {
66 "POSITION",
67 "COLOR",
68 "BCOLOR",
69 "FOG",
70 "PSIZE",
71 "GENERIC",
72 "NORMAL",
73 "FACE",
74 "EDGEFLAG",
75 "PRIM_ID",
76 "INSTANCEID",
77 "VERTEXID",
78 "STENCIL",
79 "CLIPDIST",
80 "CLIPVERTEX",
81 "GRID_SIZE",
82 "BLOCK_ID",
83 "BLOCK_SIZE",
84 "THREAD_ID",
85 "TEXCOORD",
86 "PCOORD",
87 "VIEWPORT_INDEX",
88 "LAYER",
89 "SAMPLEID",
90 "SAMPLEPOS",
91 "SAMPLEMASK",
92 "INVOCATIONID",
93 "VERTEXID_NOBASE",
94 "BASEVERTEX",
95 "PATCH",
96 "TESSCOORD",
97 "TESSOUTER",
98 "TESSINNER",
99 "VERTICESIN",
100 "HELPER_INVOCATION",
101 "BASEINSTANCE",
102 "DRAWID",
103 "WORK_DIM",
104 "SUBGROUP_SIZE",
105 "SUBGROUP_INVOCATION",
106 "SUBGROUP_EQ_MASK",
107 "SUBGROUP_GE_MASK",
108 "SUBGROUP_GT_MASK",
109 "SUBGROUP_LE_MASK",
110 "SUBGROUP_LT_MASK",
111 "CS_USER_DATA_AMD",
112 "VIEWPORT_MASK",
113 };
114
115 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
116 {
117 "BUFFER",
118 "1D",
119 "2D",
120 "3D",
121 "CUBE",
122 "RECT",
123 "SHADOW1D",
124 "SHADOW2D",
125 "SHADOWRECT",
126 "1D_ARRAY",
127 "2D_ARRAY",
128 "SHADOW1D_ARRAY",
129 "SHADOW2D_ARRAY",
130 "SHADOWCUBE",
131 "2D_MSAA",
132 "2D_ARRAY_MSAA",
133 "CUBEARRAY",
134 "SHADOWCUBEARRAY",
135 "UNKNOWN",
136 };
137
138 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
139 {
140 "GS_INPUT_PRIMITIVE",
141 "GS_OUTPUT_PRIMITIVE",
142 "GS_MAX_OUTPUT_VERTICES",
143 "FS_COORD_ORIGIN",
144 "FS_COORD_PIXEL_CENTER",
145 "FS_COLOR0_WRITES_ALL_CBUFS",
146 "FS_DEPTH_LAYOUT",
147 "VS_PROHIBIT_UCPS",
148 "GS_INVOCATIONS",
149 "VS_WINDOW_SPACE_POSITION",
150 "TCS_VERTICES_OUT",
151 "TES_PRIM_MODE",
152 "TES_SPACING",
153 "TES_VERTEX_ORDER_CW",
154 "TES_POINT_MODE",
155 "NUM_CLIPDIST_ENABLED",
156 "NUM_CULLDIST_ENABLED",
157 "FS_EARLY_DEPTH_STENCIL",
158 "FS_POST_DEPTH_COVERAGE",
159 "NEXT_SHADER",
160 "CS_FIXED_BLOCK_WIDTH",
161 "CS_FIXED_BLOCK_HEIGHT",
162 "CS_FIXED_BLOCK_DEPTH",
163 "LEGACY_MATH_RULES",
164 "VS_BLIT_SGPRS_AMD",
165 "CS_USER_DATA_COMPONENTS_AMD",
166 "LAYER_VIEWPORT_RELATIVE",
167 "FS_BLEND_EQUATION_ADVANCED",
168 "SEPARABLE_PROGRAM",
169 };
170
171 const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
172 {
173 "UNORM",
174 "SNORM",
175 "SINT",
176 "UINT",
177 "FLOAT"
178 };
179
180 const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
181 {
182 "CONSTANT",
183 "LINEAR",
184 "PERSPECTIVE",
185 "COLOR"
186 };
187
188 const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
189 {
190 "CENTER",
191 "CENTROID",
192 "SAMPLE",
193 };
194
195 const char *tgsi_invariant_name = "INVARIANT";
196
197 const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
198 {
199 "POINTS",
200 "LINES",
201 "LINE_LOOP",
202 "LINE_STRIP",
203 "TRIANGLES",
204 "TRIANGLE_STRIP",
205 "TRIANGLE_FAN",
206 "QUADS",
207 "QUAD_STRIP",
208 "POLYGON",
209 "LINES_ADJACENCY",
210 "LINE_STRIP_ADJACENCY",
211 "TRIANGLES_ADJACENCY",
212 "TRIANGLE_STRIP_ADJACENCY",
213 "PATCHES",
214 };
215
216 const char *tgsi_fs_coord_origin_names[2] =
217 {
218 "UPPER_LEFT",
219 "LOWER_LEFT"
220 };
221
222 const char *tgsi_fs_coord_pixel_center_names[2] =
223 {
224 "HALF_INTEGER",
225 "INTEGER"
226 };
227
228 const char *tgsi_immediate_type_names[6] =
229 {
230 "FLT32",
231 "UINT32",
232 "INT32",
233 "FLT64",
234 "UINT64",
235 "INT64",
236 };
237
238 const char *tgsi_memory_names[4] =
239 {
240 "COHERENT",
241 "RESTRICT",
242 "VOLATILE",
243 "STREAM_CACHE_POLICY",
244 };
245
246
247 UNUSED static inline void
tgsi_strings_check(void)248 tgsi_strings_check(void)
249 {
250 STATIC_ASSERT(ARRAY_SIZE(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
251 STATIC_ASSERT(ARRAY_SIZE(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
252 STATIC_ASSERT(ARRAY_SIZE(tgsi_property_names) == TGSI_PROPERTY_COUNT);
253 STATIC_ASSERT(ARRAY_SIZE(tgsi_primitive_names) == PIPE_PRIM_MAX);
254 STATIC_ASSERT(ARRAY_SIZE(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
255 STATIC_ASSERT(ARRAY_SIZE(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
256 (void) tgsi_processor_type_names;
257 (void) tgsi_return_type_names;
258 (void) tgsi_immediate_type_names;
259 (void) tgsi_fs_coord_origin_names;
260 (void) tgsi_fs_coord_pixel_center_names;
261 }
262
263
264 const char *
tgsi_file_name(unsigned file)265 tgsi_file_name(unsigned file)
266 {
267 STATIC_ASSERT(ARRAY_SIZE(tgsi_file_names) == TGSI_FILE_COUNT);
268 if (file < ARRAY_SIZE(tgsi_file_names))
269 return tgsi_file_names[file];
270 else
271 return "invalid file";
272 }
273