• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "IMAGE",
58    "SVIEW",
59    "BUFFER",
60    "MEMORY",
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    "CULLDIST",
90    "SAMPLEID",
91    "SAMPLEPOS",
92    "SAMPLEMASK",
93    "INVOCATIONID",
94    "VERTEXID_NOBASE",
95    "BASEVERTEX",
96    "PATCH",
97    "TESSCOORD",
98    "TESSOUTER",
99    "TESSINNER",
100    "VERTICESIN",
101    "HELPER_INVOCATION",
102 };
103 
104 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
105 {
106    "BUFFER",
107    "1D",
108    "2D",
109    "3D",
110    "CUBE",
111    "RECT",
112    "SHADOW1D",
113    "SHADOW2D",
114    "SHADOWRECT",
115    "1D_ARRAY",
116    "2D_ARRAY",
117    "SHADOW1D_ARRAY",
118    "SHADOW2D_ARRAY",
119    "SHADOWCUBE",
120    "2D_MSAA",
121    "2D_ARRAY_MSAA",
122    "CUBEARRAY",
123    "SHADOWCUBEARRAY",
124    "UNKNOWN",
125 };
126 
127 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
128 {
129    "GS_INPUT_PRIMITIVE",
130    "GS_OUTPUT_PRIMITIVE",
131    "GS_MAX_OUTPUT_VERTICES",
132    "FS_COORD_ORIGIN",
133    "FS_COORD_PIXEL_CENTER",
134    "FS_COLOR0_WRITES_ALL_CBUFS",
135    "FS_DEPTH_LAYOUT",
136    "VS_PROHIBIT_UCPS",
137    "GS_INVOCATIONS",
138    "VS_WINDOW_SPACE_POSITION",
139    "TCS_VERTICES_OUT",
140    "TES_PRIM_MODE",
141    "TES_SPACING",
142    "TES_VERTEX_ORDER_CW",
143    "TES_POINT_MODE",
144    "NUM_CLIPDIST_ENABLED",
145    "NUM_CULLDIST_ENABLED",
146    "FS_EARLY_DEPTH_STENCIL",
147    "FS_POST_DEPTH_COVERAGE",
148    "NEXT_SHADER",
149    "CS_FIXED_BLOCK_WIDTH",
150    "CS_FIXED_BLOCK_HEIGHT",
151    "CS_FIXED_BLOCK_DEPTH",
152    "MUL_ZERO_WINS",
153    "VS_BLIT_SGPRS_AMD",
154    "CS_USER_DATA_COMPONENTS_AMD",
155    "LAYER_VIEWPORT_RELATIVE",
156    "FS_BLEND_EQUATION_ADVANCED",
157 };
158 
159 const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
160 {
161    "UNORM",
162    "SNORM",
163    "SINT",
164    "UINT",
165    "FLOAT"
166 };
167 
168 const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
169 {
170    "CONSTANT",
171    "LINEAR",
172    "PERSPECTIVE",
173    "COLOR"
174 };
175 
176 const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
177 {
178    "CENTER",
179    "CENTROID",
180    "SAMPLE",
181 };
182 
183 const char *tgsi_invariant_name = "INVARIANT";
184 
185 const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
186 {
187    "POINTS",
188    "LINES",
189    "LINE_LOOP",
190    "LINE_STRIP",
191    "TRIANGLES",
192    "TRIANGLE_STRIP",
193    "TRIANGLE_FAN",
194    "QUADS",
195    "QUAD_STRIP",
196    "POLYGON",
197    "LINES_ADJACENCY",
198    "LINE_STRIP_ADJACENCY",
199    "TRIANGLES_ADJACENCY",
200    "TRIANGLE_STRIP_ADJACENCY",
201    "PATCHES",
202 };
203 
204 const char *tgsi_fs_coord_origin_names[2] =
205 {
206    "UPPER_LEFT",
207    "LOWER_LEFT"
208 };
209 
210 const char *tgsi_fs_coord_pixel_center_names[2] =
211 {
212    "HALF_INTEGER",
213    "INTEGER"
214 };
215 
216 const char *tgsi_immediate_type_names[4] =
217 {
218    "FLT32",
219    "UINT32",
220    "INT32",
221    "FLT64"
222 };
223 
224 const char *tgsi_memory_names[3] =
225 {
226    "COHERENT",
227    "RESTRICT",
228    "VOLATILE",
229 };
230 
231 static inline void
tgsi_strings_check(void)232 tgsi_strings_check(void)
233 {
234    STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
235    STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
236    STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
237    STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
238    STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
239    STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
240    (void) tgsi_processor_type_names;
241    (void) tgsi_return_type_names;
242    (void) tgsi_immediate_type_names;
243    (void) tgsi_fs_coord_origin_names;
244    (void) tgsi_fs_coord_pixel_center_names;
245 }
246 
247 
248 const char *
tgsi_file_name(unsigned file)249 tgsi_file_name(unsigned file)
250 {
251    STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT);
252    if (file < Elements(tgsi_file_names))
253       return tgsi_file_names[file];
254    else
255       return "invalid file";
256 }
257