[g3dvl] move stuff from flush into own functions
[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 unsigned cylindrical_wrap,
72 struct tgsi_header *header );
73
74 struct tgsi_full_declaration
75 tgsi_default_full_declaration( void );
76
77 unsigned
78 tgsi_build_full_declaration(
79 const struct tgsi_full_declaration *full_decl,
80 struct tgsi_token *tokens,
81 struct tgsi_header *header,
82 unsigned maxsize );
83
84 struct tgsi_declaration_range
85 tgsi_default_declaration_range( void );
86
87 struct tgsi_declaration_range
88 tgsi_build_declaration_range(
89 unsigned first,
90 unsigned last,
91 struct tgsi_declaration *declaration,
92 struct tgsi_header *header );
93
94 struct tgsi_declaration_dimension
95 tgsi_default_declaration_dimension(void);
96
97 struct tgsi_declaration_dimension
98 tgsi_build_declaration_dimension(unsigned index_2d,
99 struct tgsi_declaration *declaration,
100 struct tgsi_header *header);
101
102 struct tgsi_declaration_semantic
103 tgsi_default_declaration_semantic( void );
104
105 struct tgsi_declaration_semantic
106 tgsi_build_declaration_semantic(
107 unsigned semantic_name,
108 unsigned semantic_index,
109 struct tgsi_declaration *declaration,
110 struct tgsi_header *header );
111
112 /*
113 * immediate
114 */
115
116 struct tgsi_immediate
117 tgsi_default_immediate( void );
118
119 struct tgsi_immediate
120 tgsi_build_immediate(
121 struct tgsi_header *header );
122
123 struct tgsi_full_immediate
124 tgsi_default_full_immediate( void );
125
126 union tgsi_immediate_data
127 tgsi_build_immediate_float32(
128 float value,
129 struct tgsi_immediate *immediate,
130 struct tgsi_header *header );
131
132 unsigned
133 tgsi_build_full_immediate(
134 const struct tgsi_full_immediate *full_imm,
135 struct tgsi_token *tokens,
136 struct tgsi_header *header,
137 unsigned maxsize );
138
139 /*
140 * properties
141 */
142
143 struct tgsi_property
144 tgsi_default_property( void );
145
146 struct tgsi_property
147 tgsi_build_property(
148 unsigned property_name,
149 struct tgsi_header *header );
150
151 struct tgsi_full_property
152 tgsi_default_full_property( void );
153
154 struct tgsi_property_data
155 tgsi_build_property_data(
156 unsigned value,
157 struct tgsi_property *property,
158 struct tgsi_header *header );
159
160 unsigned
161 tgsi_build_full_property(
162 const struct tgsi_full_property *full_prop,
163 struct tgsi_token *tokens,
164 struct tgsi_header *header,
165 unsigned maxsize );
166
167 /*
168 * instruction
169 */
170
171 struct tgsi_instruction
172 tgsi_default_instruction( void );
173
174 struct tgsi_instruction
175 tgsi_build_instruction(
176 unsigned opcode,
177 unsigned saturate,
178 unsigned predicate,
179 unsigned num_dst_regs,
180 unsigned num_src_regs,
181 struct tgsi_header *header );
182
183 struct tgsi_full_instruction
184 tgsi_default_full_instruction( void );
185
186 unsigned
187 tgsi_build_full_instruction(
188 const struct tgsi_full_instruction *full_inst,
189 struct tgsi_token *tokens,
190 struct tgsi_header *header,
191 unsigned maxsize );
192
193 struct tgsi_instruction_predicate
194 tgsi_default_instruction_predicate(void);
195
196 struct tgsi_instruction_predicate
197 tgsi_build_instruction_predicate(int index,
198 unsigned negate,
199 unsigned swizzleX,
200 unsigned swizzleY,
201 unsigned swizzleZ,
202 unsigned swizzleW,
203 struct tgsi_instruction *instruction,
204 struct tgsi_header *header);
205
206 struct tgsi_instruction_label
207 tgsi_default_instruction_label( void );
208
209 struct tgsi_instruction_label
210 tgsi_build_instruction_label(
211 unsigned label,
212 struct tgsi_token *prev_token,
213 struct tgsi_instruction *instruction,
214 struct tgsi_header *header );
215
216 struct tgsi_instruction_texture
217 tgsi_default_instruction_texture( void );
218
219 struct tgsi_instruction_texture
220 tgsi_build_instruction_texture(
221 unsigned texture,
222 struct tgsi_token *prev_token,
223 struct tgsi_instruction *instruction,
224 struct tgsi_header *header );
225
226 struct tgsi_src_register
227 tgsi_default_src_register( void );
228
229 struct tgsi_src_register
230 tgsi_build_src_register(
231 unsigned file,
232 unsigned swizzle_x,
233 unsigned swizzle_y,
234 unsigned swizzle_z,
235 unsigned swizzle_w,
236 unsigned negate,
237 unsigned absolute,
238 unsigned indirect,
239 unsigned dimension,
240 int index,
241 struct tgsi_instruction *instruction,
242 struct tgsi_header *header );
243
244 struct tgsi_full_src_register
245 tgsi_default_full_src_register( void );
246
247
248 struct tgsi_dimension
249 tgsi_default_dimension( void );
250
251 struct tgsi_dimension
252 tgsi_build_dimension(
253 unsigned indirect,
254 unsigned index,
255 struct tgsi_instruction *instruction,
256 struct tgsi_header *header );
257
258 struct tgsi_dst_register
259 tgsi_default_dst_register( void );
260
261 struct tgsi_dst_register
262 tgsi_build_dst_register(
263 unsigned file,
264 unsigned mask,
265 unsigned indirect,
266 unsigned dimension,
267 int index,
268 struct tgsi_instruction *instruction,
269 struct tgsi_header *header );
270
271 struct tgsi_full_dst_register
272 tgsi_default_full_dst_register( void );
273
274
275 #if defined __cplusplus
276 }
277 #endif
278
279 #endif /* TGSI_BUILD_H */