Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VertexElement"/> struct.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="type">The type.</param>
 /// <param name="method">The method.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="usageIndex">Index of the usage.</param>
 public VertexElement(short stream, short offset, DeclarationType type, DeclarationMethod method, DeclarationUsage usage, byte usageIndex)
 {
     Stream = stream;
     Offset = offset;
     Type = type;
     Method = method;
     Usage = usage;
     UsageIndex = usageIndex;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VertexElement"/> struct.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="type">The type.</param>
 /// <param name="method">The method.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="usageIndex">Index of the usage.</param>
 public VertexElement(short stream, short offset, DeclarationType type, DeclarationMethod method, DeclarationUsage usage, byte usageIndex = 0)
 {
     Stream     = stream;
     Offset     = offset;
     Type       = type;
     Method     = method;
     Usage      = usage;
     UsageIndex = usageIndex;
 }
Esempio n. 3
0
 /// <summary>
 /// VertexElement - Defines input vertex data to the pipeline
 /// </summary>
 /// <param name="stream">Stream number</param>
 /// <param name="offset">Offset (if any) from the beginning of the stream to the start of the data</param>
 /// <param name="declarationType">One of several predefined types that define the data size</param>
 /// <param name="declarationMethod">Tessellator processing method. This method determines how the tessellator interprets/operates on the vertex data</param>
 /// <param name="declarationUsage">Defines the intended use of the data</param>
 /// <param name="usageIndex">Modifies the usage data to allow the user to specify multiple usage types</param>
 public VertexElement(short stream, short offset, DeclarationType declarationType, DeclarationMethod declarationMethod,
                      DeclarationUsage declarationUsage, byte usageIndex)
 {
     Stream            = stream;
     Offset            = offset;
     DeclarationType   = declarationType;
     DeclarationMethod = declarationMethod;
     DeclarationUsage  = declarationUsage;
     UsageIndex        = usageIndex;
 }
Esempio n. 4
0
        private ConstructorBuilderInfo CreateInternalClassCtor(DeclarationClass n, string name)
        {
            _currentType        = name;
            _currentTypeBuilder = _typeManager.GetBuilderInfo(n.Name);

            var method = new DeclarationMethod(name, n.Statements)
            {
                Type       = new TypeFunction(true),
                Descriptor = new MethodDescriptor(n.Type, name, n.Descriptor)
            };

            _typeManager.AddCtor(name, method);
            return(_currentTypeBuilder.ConstructorBuilder);
        }
Esempio n. 5
0
        //this is a special case since it will be the entry point..
        private MethodBuilderInfo CreateEntryPointMethod(DeclarationClass n, string name)
        {
            _currentType        = name;
            _currentTypeBuilder = _typeManager.GetBuilderInfo(n.Name);

            var method = new DeclarationMethod(name, n.Statements)
            {
                Type       = new TypeFunction(true),
                Descriptor = new MethodDescriptor(n.Type, name, n.Descriptor)
            };

            _typeManager.AddMethod(name, method);

            return(_typeManager.GetMethodBuilderInfo(_currentType, n.Name));
        }
Esempio n. 6
0
        public void AddCtor(string typeName, DeclarationMethod n)
        {
            var info     = TypeBuilderMap[typeName];
            var function = n.Type as TypeFunction;

            //simulation is the entry point, must be static
            var attributes = n.Name.Equals("Simulation", StringComparison.OrdinalIgnoreCase)
                                ? MethodAttributes.Public | MethodAttributes.Static
                                : MethodAttributes.Public;

            var builderObj = info.Builder.DefineConstructor(attributes, CallingConventions.Standard, ArgumentTypes(function));
            var formals    = n.Descriptor == null ? new List <FormalDescriptor>() : n.Descriptor.Formals;

            info.ConstructorBuilder = new ConstructorBuilderInfo(builderObj, BuildFormalMap(formals));
        }
Esempio n. 7
0
        public void AddMethod(string typeName, DeclarationMethod n)
        {
            var info = TypeBuilderMap[typeName];
            //simulation is the entry point, must be static
            var attributes = n.Name.Equals("Simulation", StringComparison.OrdinalIgnoreCase)
                                ? MethodAttributes.Public | MethodAttributes.Static
                                : MethodAttributes.Public;

            if (InternalMethodManager.IsSystemMethod(n.Name))
            {
                var method   = InternalMethodManager.Lookup(n.Name);
                var funcInfo = method.FuncInfo;
                var formals  = funcInfo.Formals.Values.Select(LookupCilType);
                var m        = info.Builder.DefineMethod(n.Name,
                                                         attributes,
                                                         LookupCilType(funcInfo.ReturnType),
                                                         formals.ToArray());

                //store this MethodBuilder, keyed off its name
                info.MethodMap.Add(n.Name, new MethodBuilderInfo(m, BuildFormalMap(n.Descriptor.Formals)));
                return;
            }


            //we need to know the CIL type for the return type and arguments
            var returnType = LookupCilType(n.ReturnType);
            var function   = (TypeFunction)n.Type;

            var methodBuilder = info.Builder.DefineMethod(n.Name,
                                                          attributes,
                                                          returnType,
                                                          function.Formals.Values.Select(LookupCilType).ToArray());

            //store this MethodBuilder, keyed off its name
            info.MethodMap.Add(n.Name, new MethodBuilderInfo(methodBuilder, BuildFormalMap(n.Descriptor.Formals)));
        }
Esempio n. 8
0
 public VertexElement(short stream, short offset, DeclarationType declType, DeclarationMethod declMethod, DeclarationUsage declUsage, byte usageIndex)
 {
 }