private ITypeHLSL MakePseudoArrayElemTypeImpl( TupleTypeHLSL type, EmitValHLSL count ) { int fieldCount = type.GetFieldCount(); TupleTypeHLSL result = new TupleTypeHLSL(type.Name); for (int ff = 0; ff < fieldCount; ++ff) { result.AddField( type.GetFieldName(ff), MakePseudoArrayElemType( type.GetFieldType(ff), count)); } return result; }
public IAggTypeHLSL EmitType(MidElementDecl element) { IAggTypeHLSL result; if (_elementTypes.TryGetValue(element, out result)) return result; // Actually emit the type, then... var name = string.Format("Tup_{0}", element.Name.ToString()); TupleTypeHLSL tupleType = new TupleTypeHLSL(name); _elementTypes[element] = tupleType; foreach (var a in element.Attributes) { if (!a.IsOutput) continue; var attrName = MapName(a); tupleType.AddField( attrName, EmitType(a.Type)); } return tupleType; }
public EmitValHLSL GetElemImpl( TupleValHLSL obj, EmitValHLSL idx) { int fieldCount = obj.GetFieldCount(); EmitValHLSL[] fieldVals = new EmitValHLSL[fieldCount]; TupleTypeHLSL resultType = new TupleTypeHLSL("temp"); for (int ff = 0; ff < fieldCount; ++ff) { fieldVals[ff] = GetElem( obj.GetFieldVal(ff), idx); resultType.AddField( obj.AggType.GetFieldName(ff), fieldVals[ff].Type); } return new TupleValHLSL( resultType, fieldVals); }