Merge branch 'master' into pipe-format-simplify
[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 semantic,
68 unsigned centroid,
69 unsigned invariant,
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 union tgsi_immediate_data
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 * properties
131 */
132
133 struct tgsi_property
134 tgsi_default_property( void );
135
136 struct tgsi_property
137 tgsi_build_property(
138 unsigned property_name,
139 struct tgsi_header *header );
140
141 struct tgsi_full_property
142 tgsi_default_full_property( void );
143
144 struct tgsi_property_data
145 tgsi_build_property_data(
146 unsigned value,
147 struct tgsi_property *property,
148 struct tgsi_header *header );
149
150 unsigned
151 tgsi_build_full_property(
152 const struct tgsi_full_property *full_prop,
153 struct tgsi_token *tokens,
154 struct tgsi_header *header,
155 unsigned maxsize );
156
157 /*
158 * instruction
159 */
160
161 struct tgsi_instruction
162 tgsi_default_instruction( void );
163
164 struct tgsi_instruction
165 tgsi_build_instruction(
166 unsigned opcode,
167 unsigned saturate,
168 unsigned predicate,
169 unsigned num_dst_regs,
170 unsigned num_src_regs,
171 struct tgsi_header *header );
172
173 struct tgsi_full_instruction
174 tgsi_default_full_instruction( void );
175
176 unsigned
177 tgsi_build_full_instruction(
178 const struct tgsi_full_instruction *full_inst,
179 struct tgsi_token *tokens,
180 struct tgsi_header *header,
181 unsigned maxsize );
182
183 struct tgsi_instruction_predicate
184 tgsi_default_instruction_predicate(void);
185
186 struct tgsi_instruction_predicate
187 tgsi_build_instruction_predicate(int index,
188 unsigned negate,
189 unsigned swizzleX,
190 unsigned swizzleY,
191 unsigned swizzleZ,
192 unsigned swizzleW,
193 struct tgsi_instruction *instruction,
194 struct tgsi_header *header);
195
196 struct tgsi_instruction_label
197 tgsi_default_instruction_label( void );
198
199 struct tgsi_instruction_label
200 tgsi_build_instruction_label(
201 unsigned label,
202 struct tgsi_token *prev_token,
203 struct tgsi_instruction *instruction,
204 struct tgsi_header *header );
205
206 struct tgsi_instruction_texture
207 tgsi_default_instruction_texture( void );
208
209 struct tgsi_instruction_texture
210 tgsi_build_instruction_texture(
211 unsigned texture,
212 struct tgsi_token *prev_token,
213 struct tgsi_instruction *instruction,
214 struct tgsi_header *header );
215
216 struct tgsi_src_register
217 tgsi_default_src_register( void );
218
219 struct tgsi_src_register
220 tgsi_build_src_register(
221 unsigned file,
222 unsigned swizzle_x,
223 unsigned swizzle_y,
224 unsigned swizzle_z,
225 unsigned swizzle_w,
226 unsigned negate,
227 unsigned absolute,
228 unsigned indirect,
229 unsigned dimension,
230 int index,
231 struct tgsi_instruction *instruction,
232 struct tgsi_header *header );
233
234 struct tgsi_full_src_register
235 tgsi_default_full_src_register( void );
236
237
238 struct tgsi_dimension
239 tgsi_default_dimension( void );
240
241 struct tgsi_dimension
242 tgsi_build_dimension(
243 unsigned indirect,
244 unsigned index,
245 struct tgsi_instruction *instruction,
246 struct tgsi_header *header );
247
248 struct tgsi_dst_register
249 tgsi_default_dst_register( void );
250
251 struct tgsi_dst_register
252 tgsi_build_dst_register(
253 unsigned file,
254 unsigned mask,
255 unsigned indirect,
256 int index,
257 struct tgsi_instruction *instruction,
258 struct tgsi_header *header );
259
260 struct tgsi_full_dst_register
261 tgsi_default_full_dst_register( void );
262
263
264 #if defined __cplusplus
265 }
266 #endif
267
268 #endif /* TGSI_BUILD_H */