Merge branch 'mesa_7_7_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 /*
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 * 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 predicate,
141 unsigned num_dst_regs,
142 unsigned num_src_regs,
143 struct tgsi_header *header );
144
145 struct tgsi_full_instruction
146 tgsi_default_full_instruction( void );
147
148 unsigned
149 tgsi_build_full_instruction(
150 const struct tgsi_full_instruction *full_inst,
151 struct tgsi_token *tokens,
152 struct tgsi_header *header,
153 unsigned maxsize );
154
155 struct tgsi_instruction_predicate
156 tgsi_default_instruction_predicate(void);
157
158 struct tgsi_instruction_predicate
159 tgsi_build_instruction_predicate(int index,
160 unsigned negate,
161 unsigned swizzleX,
162 unsigned swizzleY,
163 unsigned swizzleZ,
164 unsigned swizzleW,
165 struct tgsi_instruction *instruction,
166 struct tgsi_header *header);
167
168 struct tgsi_instruction_label
169 tgsi_default_instruction_label( void );
170
171 struct tgsi_instruction_label
172 tgsi_build_instruction_label(
173 unsigned label,
174 struct tgsi_token *prev_token,
175 struct tgsi_instruction *instruction,
176 struct tgsi_header *header );
177
178 struct tgsi_instruction_texture
179 tgsi_default_instruction_texture( void );
180
181 struct tgsi_instruction_texture
182 tgsi_build_instruction_texture(
183 unsigned texture,
184 struct tgsi_token *prev_token,
185 struct tgsi_instruction *instruction,
186 struct tgsi_header *header );
187
188 struct tgsi_src_register
189 tgsi_default_src_register( void );
190
191 struct tgsi_src_register
192 tgsi_build_src_register(
193 unsigned file,
194 unsigned swizzle_x,
195 unsigned swizzle_y,
196 unsigned swizzle_z,
197 unsigned swizzle_w,
198 unsigned negate,
199 unsigned absolute,
200 unsigned indirect,
201 unsigned dimension,
202 int index,
203 struct tgsi_instruction *instruction,
204 struct tgsi_header *header );
205
206 struct tgsi_full_src_register
207 tgsi_default_full_src_register( void );
208
209
210 struct tgsi_dimension
211 tgsi_default_dimension( void );
212
213 struct tgsi_dimension
214 tgsi_build_dimension(
215 unsigned indirect,
216 unsigned index,
217 struct tgsi_instruction *instruction,
218 struct tgsi_header *header );
219
220 struct tgsi_dst_register
221 tgsi_default_dst_register( void );
222
223 struct tgsi_dst_register
224 tgsi_build_dst_register(
225 unsigned file,
226 unsigned mask,
227 unsigned indirect,
228 int index,
229 struct tgsi_instruction *instruction,
230 struct tgsi_header *header );
231
232 struct tgsi_full_dst_register
233 tgsi_default_full_dst_register( void );
234
235
236 #if defined __cplusplus
237 }
238 #endif
239
240 #endif /* TGSI_BUILD_H */