static struct tgsi_declaration_semantic tgsi_build_declaration_semantic( unsigned semantic_name, unsigned semantic_index, unsigned streamx, unsigned streamy, unsigned streamz, unsigned streamw, struct tgsi_declaration *declaration, struct tgsi_header *header ) { struct tgsi_declaration_semantic ds; assert( semantic_name <= TGSI_SEMANTIC_COUNT ); assert( semantic_index <= 0xFFFF ); ds.Name = semantic_name; ds.Index = semantic_index; ds.StreamX = streamx; ds.StreamY = streamy; ds.StreamZ = streamz; ds.StreamW = streamw; declaration_grow( declaration, header ); return ds; }
static struct tgsi_declaration_array tgsi_build_declaration_array(unsigned arrayid, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_array da; da = tgsi_default_declaration_array(); da.ArrayID = arrayid; declaration_grow(declaration, header); return da; }
static struct tgsi_declaration_dimension tgsi_build_declaration_dimension(unsigned index_2d, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_dimension dd; assert(index_2d <= 0xFFFF); dd.Index2D = index_2d; dd.Padding = 0; declaration_grow(declaration, header); return dd; }
static struct tgsi_declaration_interp tgsi_build_declaration_interp(unsigned interpolate, unsigned centroid, unsigned cylindrical_wrap, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_interp di; di.Interpolate = interpolate; di.Centroid = centroid; di.CylindricalWrap = cylindrical_wrap; declaration_grow(declaration, header); return di; }
static struct tgsi_declaration_resource tgsi_build_declaration_resource(unsigned texture, unsigned raw, unsigned writable, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_resource dr; dr = tgsi_default_declaration_resource(); dr.Resource = texture; dr.Raw = raw; dr.Writable = writable; declaration_grow(declaration, header); return dr; }
static struct tgsi_declaration_interp tgsi_build_declaration_interp(unsigned interpolate, unsigned interpolate_location, unsigned cylindrical_wrap, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_interp di; di.Interpolate = interpolate; di.Location = interpolate_location; di.CylindricalWrap = cylindrical_wrap; di.Padding = 0; declaration_grow(declaration, header); return di; }
static struct tgsi_declaration_range tgsi_build_declaration_range( unsigned first, unsigned last, struct tgsi_declaration *declaration, struct tgsi_header *header ) { struct tgsi_declaration_range declaration_range; assert( last >= first ); assert( last <= 0xFFFF ); declaration_range.First = first; declaration_range.Last = last; declaration_grow( declaration, header ); return declaration_range; }
static struct tgsi_declaration_semantic tgsi_build_declaration_semantic( unsigned semantic_name, unsigned semantic_index, struct tgsi_declaration *declaration, struct tgsi_header *header ) { struct tgsi_declaration_semantic ds; assert( semantic_name <= TGSI_SEMANTIC_COUNT ); assert( semantic_index <= 0xFFFF ); ds.Name = semantic_name; ds.Index = semantic_index; ds.Padding = 0; declaration_grow( declaration, header ); return ds; }
static struct tgsi_declaration_image tgsi_build_declaration_image(unsigned texture, unsigned format, unsigned raw, unsigned writable, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_image di; di = tgsi_default_declaration_image(); di.Resource = texture; di.Format = format; di.Raw = raw; di.Writable = writable; declaration_grow(declaration, header); return di; }
static struct tgsi_declaration_sampler_view tgsi_build_declaration_sampler_view(unsigned texture, unsigned return_type_x, unsigned return_type_y, unsigned return_type_z, unsigned return_type_w, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_sampler_view dsv; dsv = tgsi_default_declaration_sampler_view(); dsv.Resource = texture; dsv.ReturnTypeX = return_type_x; dsv.ReturnTypeY = return_type_y; dsv.ReturnTypeZ = return_type_z; dsv.ReturnTypeW = return_type_w; declaration_grow(declaration, header); return dsv; }
static struct tgsi_declaration_resource tgsi_build_declaration_resource(unsigned texture, unsigned return_type_x, unsigned return_type_y, unsigned return_type_z, unsigned return_type_w, struct tgsi_declaration *declaration, struct tgsi_header *header) { struct tgsi_declaration_resource declaration_resource; declaration_resource = tgsi_default_declaration_resource(); declaration_resource.Resource = texture; declaration_resource.ReturnTypeX = return_type_x; declaration_resource.ReturnTypeY = return_type_y; declaration_resource.ReturnTypeZ = return_type_z; declaration_resource.ReturnTypeW = return_type_w; declaration_grow(declaration, header); return declaration_resource; }
unsigned tgsi_build_full_declaration( const struct tgsi_full_declaration *full_decl, struct tgsi_token *tokens, struct tgsi_header *header, unsigned maxsize ) { unsigned size = 0; struct tgsi_declaration *declaration; struct tgsi_declaration_range *dr; if( maxsize <= size ) return 0; declaration = (struct tgsi_declaration *) &tokens[size]; size++; *declaration = tgsi_build_declaration( full_decl->Declaration.File, full_decl->Declaration.UsageMask, full_decl->Declaration.Interpolate, full_decl->Declaration.Dimension, full_decl->Declaration.Semantic, full_decl->Declaration.Centroid, full_decl->Declaration.Invariant, full_decl->Declaration.CylindricalWrap, header ); if (maxsize <= size) return 0; dr = (struct tgsi_declaration_range *) &tokens[size]; size++; *dr = tgsi_build_declaration_range( full_decl->Range.First, full_decl->Range.Last, declaration, header ); if (full_decl->Declaration.Dimension) { struct tgsi_declaration_dimension *dd; if (maxsize <= size) { return 0; } dd = (struct tgsi_declaration_dimension *)&tokens[size]; size++; *dd = tgsi_build_declaration_dimension(full_decl->Dim.Index2D, declaration, header); } if( full_decl->Declaration.Semantic ) { struct tgsi_declaration_semantic *ds; if( maxsize <= size ) return 0; ds = (struct tgsi_declaration_semantic *) &tokens[size]; size++; *ds = tgsi_build_declaration_semantic( full_decl->Semantic.Name, full_decl->Semantic.Index, declaration, header ); } if (full_decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) { unsigned i, j; union tgsi_immediate_data *data; for (i = 0; i <= dr->Last; ++i) { for (j = 0; j < 4; ++j) { unsigned idx = i*4 + j; if (maxsize <= size) return 0; data = (union tgsi_immediate_data *) &tokens[size]; ++size; *data = full_decl->ImmediateData.u[idx]; declaration_grow( declaration, header ); } } } if (full_decl->Declaration.File == TGSI_FILE_RESOURCE) { struct tgsi_declaration_resource *dr; if (maxsize <= size) { return 0; } dr = (struct tgsi_declaration_resource *)&tokens[size]; size++; *dr = tgsi_build_declaration_resource(full_decl->Resource.Resource, full_decl->Resource.ReturnTypeX, full_decl->Resource.ReturnTypeY, full_decl->Resource.ReturnTypeZ, full_decl->Resource.ReturnTypeW, declaration, header); } return size; }