tgsi_build.h revision cdc920a0
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 32struct tgsi_token; 33 34 35#if defined __cplusplus 36extern "C" { 37#endif 38 39 40/* 41 * header 42 */ 43 44struct tgsi_header 45tgsi_build_header( void ); 46 47struct tgsi_processor 48tgsi_default_processor( void ); 49 50struct tgsi_processor 51tgsi_build_processor( 52 unsigned processor, 53 struct tgsi_header *header ); 54 55/* 56 * declaration 57 */ 58 59struct tgsi_declaration 60tgsi_default_declaration( void ); 61 62struct tgsi_declaration 63tgsi_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 74struct tgsi_full_declaration 75tgsi_default_full_declaration( void ); 76 77unsigned 78tgsi_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 84struct tgsi_declaration_range 85tgsi_default_declaration_range( void ); 86 87struct tgsi_declaration_range 88tgsi_build_declaration_range( 89 unsigned first, 90 unsigned last, 91 struct tgsi_declaration *declaration, 92 struct tgsi_header *header ); 93 94struct tgsi_declaration_dimension 95tgsi_default_declaration_dimension(void); 96 97struct tgsi_declaration_dimension 98tgsi_build_declaration_dimension(unsigned index_2d, 99 struct tgsi_declaration *declaration, 100 struct tgsi_header *header); 101 102struct tgsi_declaration_semantic 103tgsi_default_declaration_semantic( void ); 104 105struct tgsi_declaration_semantic 106tgsi_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 116struct tgsi_immediate 117tgsi_default_immediate( void ); 118 119struct tgsi_immediate 120tgsi_build_immediate( 121 struct tgsi_header *header ); 122 123struct tgsi_full_immediate 124tgsi_default_full_immediate( void ); 125 126union tgsi_immediate_data 127tgsi_build_immediate_float32( 128 float value, 129 struct tgsi_immediate *immediate, 130 struct tgsi_header *header ); 131 132unsigned 133tgsi_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 143struct tgsi_property 144tgsi_default_property( void ); 145 146struct tgsi_property 147tgsi_build_property( 148 unsigned property_name, 149 struct tgsi_header *header ); 150 151struct tgsi_full_property 152tgsi_default_full_property( void ); 153 154struct tgsi_property_data 155tgsi_build_property_data( 156 unsigned value, 157 struct tgsi_property *property, 158 struct tgsi_header *header ); 159 160unsigned 161tgsi_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 171struct tgsi_instruction 172tgsi_default_instruction( void ); 173 174struct tgsi_instruction 175tgsi_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 183struct tgsi_full_instruction 184tgsi_default_full_instruction( void ); 185 186unsigned 187tgsi_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 193struct tgsi_instruction_predicate 194tgsi_default_instruction_predicate(void); 195 196struct tgsi_instruction_predicate 197tgsi_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 206struct tgsi_instruction_label 207tgsi_default_instruction_label( void ); 208 209struct tgsi_instruction_label 210tgsi_build_instruction_label( 211 unsigned label, 212 struct tgsi_token *prev_token, 213 struct tgsi_instruction *instruction, 214 struct tgsi_header *header ); 215 216struct tgsi_instruction_texture 217tgsi_default_instruction_texture( void ); 218 219struct tgsi_instruction_texture 220tgsi_build_instruction_texture( 221 unsigned texture, 222 struct tgsi_token *prev_token, 223 struct tgsi_instruction *instruction, 224 struct tgsi_header *header ); 225 226struct tgsi_src_register 227tgsi_default_src_register( void ); 228 229struct tgsi_src_register 230tgsi_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 244struct tgsi_full_src_register 245tgsi_default_full_src_register( void ); 246 247 248struct tgsi_dimension 249tgsi_default_dimension( void ); 250 251struct tgsi_dimension 252tgsi_build_dimension( 253 unsigned indirect, 254 unsigned index, 255 struct tgsi_instruction *instruction, 256 struct tgsi_header *header ); 257 258struct tgsi_dst_register 259tgsi_default_dst_register( void ); 260 261struct tgsi_dst_register 262tgsi_build_dst_register( 263 unsigned file, 264 unsigned mask, 265 unsigned indirect, 266 int index, 267 struct tgsi_instruction *instruction, 268 struct tgsi_header *header ); 269 270struct tgsi_full_dst_register 271tgsi_default_full_dst_register( void ); 272 273 274#if defined __cplusplus 275} 276#endif 277 278#endif /* TGSI_BUILD_H */ 279