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