Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/mesa into gallium-0.2
[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 * version
41 */
42
43 struct tgsi_version
44 tgsi_build_version( void );
45
46 /*
47 * header
48 */
49
50 struct tgsi_header
51 tgsi_build_header( void );
52
53 struct tgsi_processor
54 tgsi_default_processor( void );
55
56 struct tgsi_processor
57 tgsi_build_processor(
58 unsigned processor,
59 struct tgsi_header *header );
60
61 /*
62 * declaration
63 */
64
65 struct tgsi_declaration
66 tgsi_default_declaration( void );
67
68 struct tgsi_declaration
69 tgsi_build_declaration(
70 unsigned file,
71 unsigned usage_mask,
72 unsigned interpolate,
73 unsigned semantic,
74 struct tgsi_header *header );
75
76 struct tgsi_full_declaration
77 tgsi_default_full_declaration( void );
78
79 unsigned
80 tgsi_build_full_declaration(
81 const struct tgsi_full_declaration *full_decl,
82 struct tgsi_token *tokens,
83 struct tgsi_header *header,
84 unsigned maxsize );
85
86 struct tgsi_declaration_range
87 tgsi_default_declaration_range( void );
88
89 struct tgsi_declaration_range
90 tgsi_build_declaration_range(
91 unsigned first,
92 unsigned last,
93 struct tgsi_declaration *declaration,
94 struct tgsi_header *header );
95
96 struct tgsi_declaration_semantic
97 tgsi_default_declaration_semantic( void );
98
99 struct tgsi_declaration_semantic
100 tgsi_build_declaration_semantic(
101 unsigned semantic_name,
102 unsigned semantic_index,
103 struct tgsi_declaration *declaration,
104 struct tgsi_header *header );
105
106 /*
107 * immediate
108 */
109
110 struct tgsi_immediate
111 tgsi_default_immediate( void );
112
113 struct tgsi_immediate
114 tgsi_build_immediate(
115 struct tgsi_header *header );
116
117 struct tgsi_full_immediate
118 tgsi_default_full_immediate( void );
119
120 struct tgsi_immediate_float32
121 tgsi_build_immediate_float32(
122 float value,
123 struct tgsi_immediate *immediate,
124 struct tgsi_header *header );
125
126 unsigned
127 tgsi_build_full_immediate(
128 const struct tgsi_full_immediate *full_imm,
129 struct tgsi_token *tokens,
130 struct tgsi_header *header,
131 unsigned maxsize );
132
133 /*
134 * instruction
135 */
136
137 struct tgsi_instruction
138 tgsi_default_instruction( void );
139
140 struct tgsi_instruction
141 tgsi_build_instruction(
142 unsigned opcode,
143 unsigned saturate,
144 unsigned num_dst_regs,
145 unsigned num_src_regs,
146 struct tgsi_header *header );
147
148 struct tgsi_full_instruction
149 tgsi_default_full_instruction( void );
150
151 unsigned
152 tgsi_build_full_instruction(
153 const struct tgsi_full_instruction *full_inst,
154 struct tgsi_token *tokens,
155 struct tgsi_header *header,
156 unsigned maxsize );
157
158 struct tgsi_instruction_ext_nv
159 tgsi_default_instruction_ext_nv( void );
160
161 unsigned
162 tgsi_compare_instruction_ext_nv(
163 struct tgsi_instruction_ext_nv a,
164 struct tgsi_instruction_ext_nv b );
165
166 struct tgsi_instruction_ext_nv
167 tgsi_build_instruction_ext_nv(
168 unsigned precision,
169 unsigned cond_dst_index,
170 unsigned cond_flow_index,
171 unsigned cond_mask,
172 unsigned cond_swizzle_x,
173 unsigned cond_swizzle_y,
174 unsigned cond_swizzle_z,
175 unsigned cond_swizzle_w,
176 unsigned cond_dst_update,
177 unsigned cond_flow_enable,
178 struct tgsi_token *prev_token,
179 struct tgsi_instruction *instruction,
180 struct tgsi_header *header );
181
182 struct tgsi_instruction_ext_label
183 tgsi_default_instruction_ext_label( void );
184
185 unsigned
186 tgsi_compare_instruction_ext_label(
187 struct tgsi_instruction_ext_label a,
188 struct tgsi_instruction_ext_label b );
189
190 struct tgsi_instruction_ext_label
191 tgsi_build_instruction_ext_label(
192 unsigned label,
193 struct tgsi_token *prev_token,
194 struct tgsi_instruction *instruction,
195 struct tgsi_header *header );
196
197 struct tgsi_instruction_ext_texture
198 tgsi_default_instruction_ext_texture( void );
199
200 unsigned
201 tgsi_compare_instruction_ext_texture(
202 struct tgsi_instruction_ext_texture a,
203 struct tgsi_instruction_ext_texture b );
204
205 struct tgsi_instruction_ext_texture
206 tgsi_build_instruction_ext_texture(
207 unsigned texture,
208 struct tgsi_token *prev_token,
209 struct tgsi_instruction *instruction,
210 struct tgsi_header *header );
211
212 struct tgsi_src_register
213 tgsi_default_src_register( void );
214
215 struct tgsi_src_register
216 tgsi_build_src_register(
217 unsigned file,
218 unsigned swizzle_x,
219 unsigned swizzle_y,
220 unsigned swizzle_z,
221 unsigned swizzle_w,
222 unsigned negate,
223 unsigned indirect,
224 unsigned dimension,
225 int index,
226 struct tgsi_instruction *instruction,
227 struct tgsi_header *header );
228
229 struct tgsi_full_src_register
230 tgsi_default_full_src_register( void );
231
232 struct tgsi_src_register_ext_swz
233 tgsi_default_src_register_ext_swz( void );
234
235 unsigned
236 tgsi_compare_src_register_ext_swz(
237 struct tgsi_src_register_ext_swz a,
238 struct tgsi_src_register_ext_swz b );
239
240 struct tgsi_src_register_ext_swz
241 tgsi_build_src_register_ext_swz(
242 unsigned ext_swizzle_x,
243 unsigned ext_swizzle_y,
244 unsigned ext_swizzle_z,
245 unsigned ext_swizzle_w,
246 unsigned negate_x,
247 unsigned negate_y,
248 unsigned negate_z,
249 unsigned negate_w,
250 struct tgsi_token *prev_token,
251 struct tgsi_instruction *instruction,
252 struct tgsi_header *header );
253
254 struct tgsi_src_register_ext_mod
255 tgsi_default_src_register_ext_mod( void );
256
257 unsigned
258 tgsi_compare_src_register_ext_mod(
259 struct tgsi_src_register_ext_mod a,
260 struct tgsi_src_register_ext_mod b );
261
262 struct tgsi_src_register_ext_mod
263 tgsi_build_src_register_ext_mod(
264 unsigned complement,
265 unsigned bias,
266 unsigned scale_2x,
267 unsigned absolute,
268 unsigned negate,
269 struct tgsi_token *prev_token,
270 struct tgsi_instruction *instruction,
271 struct tgsi_header *header );
272
273 struct tgsi_dimension
274 tgsi_default_dimension( void );
275
276 struct tgsi_dimension
277 tgsi_build_dimension(
278 unsigned indirect,
279 unsigned index,
280 struct tgsi_instruction *instruction,
281 struct tgsi_header *header );
282
283 struct tgsi_dst_register
284 tgsi_default_dst_register( void );
285
286 struct tgsi_dst_register
287 tgsi_build_dst_register(
288 unsigned file,
289 unsigned mask,
290 int index,
291 struct tgsi_instruction *instruction,
292 struct tgsi_header *header );
293
294 struct tgsi_full_dst_register
295 tgsi_default_full_dst_register( void );
296
297 struct tgsi_dst_register_ext_concode
298 tgsi_default_dst_register_ext_concode( void );
299
300 unsigned
301 tgsi_compare_dst_register_ext_concode(
302 struct tgsi_dst_register_ext_concode a,
303 struct tgsi_dst_register_ext_concode b );
304
305 struct tgsi_dst_register_ext_concode
306 tgsi_build_dst_register_ext_concode(
307 unsigned cc,
308 unsigned swizzle_x,
309 unsigned swizzle_y,
310 unsigned swizzle_z,
311 unsigned swizzle_w,
312 int index,
313 struct tgsi_token *prev_token,
314 struct tgsi_instruction *instruction,
315 struct tgsi_header *header );
316
317 struct tgsi_dst_register_ext_modulate
318 tgsi_default_dst_register_ext_modulate( void );
319
320 unsigned
321 tgsi_compare_dst_register_ext_modulate(
322 struct tgsi_dst_register_ext_modulate a,
323 struct tgsi_dst_register_ext_modulate b );
324
325 struct tgsi_dst_register_ext_modulate
326 tgsi_build_dst_register_ext_modulate(
327 unsigned modulate,
328 struct tgsi_token *prev_token,
329 struct tgsi_instruction *instruction,
330 struct tgsi_header *header );
331
332 #if defined __cplusplus
333 }
334 #endif
335
336 #endif /* TGSI_BUILD_H */