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