tgsi: Handle two-dimensional constants in text parser.
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_build.h
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef TGSI_BUILD_H
29 #define TGSI_BUILD_H
30
31
32 struct tgsi_token;
33
34
35 #if defined __cplusplus
36 extern "C" {
37 #endif
38
39
40 /*
41 * header
42 */
43
44 struct tgsi_header
45 tgsi_build_header( void );
46
47 struct tgsi_processor
48 tgsi_default_processor( void );
49
50 struct tgsi_processor
51 tgsi_build_processor(
52 unsigned processor,
53 struct tgsi_header *header );
54
55 /*
56 * declaration
57 */
58
59 struct tgsi_declaration
60 tgsi_default_declaration( void );
61
62 struct tgsi_declaration
63 tgsi_build_declaration(
64 unsigned file,
65 unsigned usage_mask,
66 unsigned interpolate,
67 unsigned dimension,
68 unsigned semantic,
69 unsigned centroid,
70 unsigned invariant,
71 struct tgsi_header *header );
72
73 struct tgsi_full_declaration
74 tgsi_default_full_declaration( void );
75
76 unsigned
77 tgsi_build_full_declaration(
78 const struct tgsi_full_declaration *full_decl,
79 struct tgsi_token *tokens,
80 struct tgsi_header *header,
81 unsigned maxsize );
82
83 struct tgsi_declaration_range
84 tgsi_default_declaration_range( void );
85
86 struct tgsi_declaration_range
87 tgsi_build_declaration_range(
88 unsigned first,
89 unsigned last,
90 struct tgsi_declaration *declaration,
91 struct tgsi_header *header );
92
93 struct tgsi_declaration_dimension
94 tgsi_default_declaration_dimension(void);
95
96 struct tgsi_declaration_dimension
97 tgsi_build_declaration_dimension(unsigned index_2d,
98 struct tgsi_declaration *declaration,
99 struct tgsi_header *header);
100
101 struct tgsi_declaration_semantic
102 tgsi_default_declaration_semantic( void );
103
104 struct tgsi_declaration_semantic
105 tgsi_build_declaration_semantic(
106 unsigned semantic_name,
107 unsigned semantic_index,
108 struct tgsi_declaration *declaration,
109 struct tgsi_header *header );
110
111 /*
112 * immediate
113 */
114
115 struct tgsi_immediate
116 tgsi_default_immediate( void );
117
118 struct tgsi_immediate
119 tgsi_build_immediate(
120 struct tgsi_header *header );
121
122 struct tgsi_full_immediate
123 tgsi_default_full_immediate( void );
124
125 union tgsi_immediate_data
126 tgsi_build_immediate_float32(
127 float value,
128 struct tgsi_immediate *immediate,
129 struct tgsi_header *header );
130
131 unsigned
132 tgsi_build_full_immediate(
133 const struct tgsi_full_immediate *full_imm,
134 struct tgsi_token *tokens,
135 struct tgsi_header *header,
136 unsigned maxsize );
137
138 /*
139 * properties
140 */
141
142 struct tgsi_property
143 tgsi_default_property( void );
144
145 struct tgsi_property
146 tgsi_build_property(
147 unsigned property_name,
148 struct tgsi_header *header );
149
150 struct tgsi_full_property
151 tgsi_default_full_property( void );
152
153 struct tgsi_property_data
154 tgsi_build_property_data(
155 unsigned value,
156 struct tgsi_property *property,
157 struct tgsi_header *header );
158
159 unsigned
160 tgsi_build_full_property(
161 const struct tgsi_full_property *full_prop,
162 struct tgsi_token *tokens,
163 struct tgsi_header *header,
164 unsigned maxsize );
165
166 /*
167 * instruction
168 */
169
170 struct tgsi_instruction
171 tgsi_default_instruction( void );
172
173 struct tgsi_instruction
174 tgsi_build_instruction(
175 unsigned opcode,
176 unsigned saturate,
177 unsigned predicate,
178 unsigned num_dst_regs,
179 unsigned num_src_regs,
180 struct tgsi_header *header );
181
182 struct tgsi_full_instruction
183 tgsi_default_full_instruction( void );
184
185 unsigned
186 tgsi_build_full_instruction(
187 const struct tgsi_full_instruction *full_inst,
188 struct tgsi_token *tokens,
189 struct tgsi_header *header,
190 unsigned maxsize );
191
192 struct tgsi_instruction_predicate
193 tgsi_default_instruction_predicate(void);
194
195 struct tgsi_instruction_predicate
196 tgsi_build_instruction_predicate(int index,
197 unsigned negate,
198 unsigned swizzleX,
199 unsigned swizzleY,
200 unsigned swizzleZ,
201 unsigned swizzleW,
202 struct tgsi_instruction *instruction,
203 struct tgsi_header *header);
204
205 struct tgsi_instruction_label
206 tgsi_default_instruction_label( void );
207
208 struct tgsi_instruction_label
209 tgsi_build_instruction_label(
210 unsigned label,
211 struct tgsi_token *prev_token,
212 struct tgsi_instruction *instruction,
213 struct tgsi_header *header );
214
215 struct tgsi_instruction_texture
216 tgsi_default_instruction_texture( void );
217
218 struct tgsi_instruction_texture
219 tgsi_build_instruction_texture(
220 unsigned texture,
221 struct tgsi_token *prev_token,
222 struct tgsi_instruction *instruction,
223 struct tgsi_header *header );
224
225 struct tgsi_src_register
226 tgsi_default_src_register( void );
227
228 struct tgsi_src_register
229 tgsi_build_src_register(
230 unsigned file,
231 unsigned swizzle_x,
232 unsigned swizzle_y,
233 unsigned swizzle_z,
234 unsigned swizzle_w,
235 unsigned negate,
236 unsigned absolute,
237 unsigned indirect,
238 unsigned dimension,
239 int index,
240 struct tgsi_instruction *instruction,
241 struct tgsi_header *header );
242
243 struct tgsi_full_src_register
244 tgsi_default_full_src_register( void );
245
246
247 struct tgsi_dimension
248 tgsi_default_dimension( void );
249
250 struct tgsi_dimension
251 tgsi_build_dimension(
252 unsigned indirect,
253 unsigned index,
254 struct tgsi_instruction *instruction,
255 struct tgsi_header *header );
256
257 struct tgsi_dst_register
258 tgsi_default_dst_register( void );
259
260 struct tgsi_dst_register
261 tgsi_build_dst_register(
262 unsigned file,
263 unsigned mask,
264 unsigned indirect,
265 int index,
266 struct tgsi_instruction *instruction,
267 struct tgsi_header *header );
268
269 struct tgsi_full_dst_register
270 tgsi_default_full_dst_register( void );
271
272
273 #if defined __cplusplus
274 }
275 #endif
276
277 #endif /* TGSI_BUILD_H */