Наследование: MidType, IMidMemberRef
Пример #1
0
 private static void DumpTypeImpl(
     MidStructRef structRef,
     Span span)
 {
     span.Write("{0}", structRef.Decl.Name);
 }
Пример #2
0
        private SizeInfo GetSizeInfoImpl(MidStructRef type)
        {
            UInt32 totalSize = 0;
            UInt32 maxAlign = 1;
            foreach (var f in type.Fields)
            {
                var fieldInfo = GetSizeInfo(f.Type);

                UInt32 fieldSize = fieldInfo.Size;
                UInt32 fieldAlign = fieldInfo.Align;

                // pad to align
                totalSize = ((totalSize + (fieldAlign - 1)) / fieldAlign) * fieldAlign;

                totalSize += fieldSize;
                maxAlign = Math.Max(maxAlign, fieldAlign);
            }

            return new SizeInfo { Size = totalSize, Align = maxAlign };
        }
 public ITypeHLSL EmitTypeImpl(MidStructRef structRef)
 {
     return EmitType(structRef.Decl);
 }
        private AttributeInfo GenerateInputElementsImpl(
            SourceRange range,
            string name,
            MidStructRef type,
            int vertexStream,
            IndexSourceInfo index,
            UInt32 baseOffset,
            int inputSlotIndex)
        {
            var fields = new List<FieldInfo>();
            UInt32 totalOffset = baseOffset;
            foreach (var f in type.Fields)
            {
                // \todo: Align

                fields.Add(new FieldInfo
                {
                    Field = f,
                    Info = GenerateInputElements(
                      range,
                      string.Format("{0}_{1}", name, f.Name.ToString()),
                      f.Type,
                      vertexStream,
                      index,
                      totalOffset)
                });

                totalOffset += GetSizeOf(f.Type);
            }

            return new StructInfo(range) { Fields = fields.ToArray() };
        }