gallium: add tessellation shader types
[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 };
94
95 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
96 {
97 "BUFFER",
98 "1D",
99 "2D",
100 "3D",
101 "CUBE",
102 "RECT",
103 "SHADOW1D",
104 "SHADOW2D",
105 "SHADOWRECT",
106 "1D_ARRAY",
107 "2D_ARRAY",
108 "SHADOW1D_ARRAY",
109 "SHADOW2D_ARRAY",
110 "SHADOWCUBE",
111 "2D_MSAA",
112 "2D_ARRAY_MSAA",
113 "CUBEARRAY",
114 "SHADOWCUBEARRAY",
115 "UNKNOWN",
116 };
117
118 const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
119 {
120 "GS_INPUT_PRIMITIVE",
121 "GS_OUTPUT_PRIMITIVE",
122 "GS_MAX_OUTPUT_VERTICES",
123 "FS_COORD_ORIGIN",
124 "FS_COORD_PIXEL_CENTER",
125 "FS_COLOR0_WRITES_ALL_CBUFS",
126 "FS_DEPTH_LAYOUT",
127 "VS_PROHIBIT_UCPS",
128 "GS_INVOCATIONS",
129 "VS_WINDOW_SPACE_POSITION"
130 };
131
132 const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
133 {
134 "UNORM",
135 "SNORM",
136 "SINT",
137 "UINT",
138 "FLOAT"
139 };
140
141 const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
142 {
143 "CONSTANT",
144 "LINEAR",
145 "PERSPECTIVE",
146 "COLOR"
147 };
148
149 const char *tgsi_interpolate_locations[TGSI_INTERPOLATE_LOC_COUNT] =
150 {
151 "CENTER",
152 "CENTROID",
153 "SAMPLE",
154 };
155
156 const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
157 {
158 "POINTS",
159 "LINES",
160 "LINE_LOOP",
161 "LINE_STRIP",
162 "TRIANGLES",
163 "TRIANGLE_STRIP",
164 "TRIANGLE_FAN",
165 "QUADS",
166 "QUAD_STRIP",
167 "POLYGON",
168 "LINES_ADJACENCY",
169 "LINE_STRIP_ADJACENCY",
170 "TRIANGLES_ADJACENCY",
171 "TRIANGLE_STRIP_ADJACENCY"
172 };
173
174 const char *tgsi_fs_coord_origin_names[2] =
175 {
176 "UPPER_LEFT",
177 "LOWER_LEFT"
178 };
179
180 const char *tgsi_fs_coord_pixel_center_names[2] =
181 {
182 "HALF_INTEGER",
183 "INTEGER"
184 };
185
186 const char *tgsi_immediate_type_names[4] =
187 {
188 "FLT32",
189 "UINT32",
190 "INT32",
191 "FLT64"
192 };
193
194
195 static INLINE void
196 tgsi_strings_check(void)
197 {
198 STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
199 STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
200 STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
201 STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
202 STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
203 STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
204 (void) tgsi_processor_type_names;
205 (void) tgsi_return_type_names;
206 (void) tgsi_immediate_type_names;
207 (void) tgsi_fs_coord_origin_names;
208 (void) tgsi_fs_coord_pixel_center_names;
209 }
210
211
212 const char *
213 tgsi_file_name(unsigned file)
214 {
215 STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT);
216 if (file < Elements(tgsi_file_names))
217 return tgsi_file_names[file];
218 else
219 return "invalid file";
220 }