private static string FormatBatchBreakingReason(UISystemProfilerInfo info)
        {
            switch (info.batchBreakingReason)
            {
            case BatchBreakingReason.NoBreaking:
                return("NoBreaking");

            case BatchBreakingReason.NotCoplanarWithCanvas:
                return("Not Coplanar With Canvas");

            case BatchBreakingReason.CanvasInjectionIndex:
                return("Canvas Injection Index");

            case BatchBreakingReason.DifferentMaterialInstance:
                return("Different Material Instance");

            case BatchBreakingReason.DifferentRectClipping:
                return("Different Rect Clipping");

            case BatchBreakingReason.DifferentTexture:
                return("Different Texture");

            case BatchBreakingReason.DifferentA8TextureUsage:
                return("Different A8 Texture Usage");

            case BatchBreakingReason.DifferentClipRect:
                return("Different Clip Rect");

            case BatchBreakingReason.Unknown:
                return("Unknown");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
 public BatchTreeViewItem(UISystemProfilerInfo info, int depth, string displayName, int[] allBatchesInstanceIDs) : base(info, depth, displayName)
 {
     this.icon        = null;
     this.instanceIDs = new int[info.instanceIDsCount];
     Array.Copy(allBatchesInstanceIDs, info.instanceIDsIndex, this.instanceIDs, 0, info.instanceIDsCount);
     this.renderDataIndex = info.renderDataIndex;
 }
 public CanvasTreeViewItem(UISystemProfilerInfo info, int depth, string displayName) : base(info, depth, displayName)
 {
     icon = s_CanvasIcon;
 }
 internal BaseTreeViewItem(UISystemProfilerInfo info, int depth, string displayName)
     : base(info.objectInstanceId, depth, displayName)
 {
     this.info = info;
 }
        private string GetItemcontent(RowGUIArgs args, int column)
        {
            if (m_AllCanvasesItem != null && args.item.id == m_AllCanvasesItem.id)
            {
                switch ((Column)column)
                {
                case Column.TotalBatchCount:
                    return(m_AllCanvasesItem.totalBatchCount.ToString());

                case Column.TotalVertexCount:
                    return(m_AllCanvasesItem.totalVertexCount.ToString());

                case Column.GameObjectCount:
                    return(m_AllCanvasesItem.gameObjectCount.ToString());

                default:
                    return(null);
                }
            }

            var batchItem = args.item as BatchTreeViewItem;

            if (batchItem != null)
            {
                var info = batchItem.info;
                switch ((Column)column)
                {
                case Column.VertexCount:
                    return(info.vertexCount.ToString());

                case Column.TotalVertexCount:
                    return(info.totalVertexCount.ToString());

                case Column.BatchBreakingReason:
                    if (info.batchBreakingReason != BatchBreakingReason.NoBreaking)
                    {
                        return(FormatBatchBreakingReason(info));
                    }
                    break;

                case Column.GameObjectCount:
                    return(info.instanceIDsCount.ToString());

                case Column.InstanceIds:
                    if (batchItem.instanceIDs.Length <= 5)
                    {
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i < batchItem.instanceIDs.Length; i++)
                        {
                            if (i != 0)
                            {
                                sb.Append(", ");
                            }
                            int iid = batchItem.instanceIDs[i];
                            var o   = EditorUtility.InstanceIDToObject(iid);
                            if (o == null)
                            {
                                sb.Append(iid);
                            }
                            else
                            {
                                sb.Append(o.name);
                            }
                        }
                        return(sb.ToString());
                    }
                    return(string.Format("{0} objects", batchItem.instanceIDs.Length));

                case Column.Element:
                case Column.BatchCount:
                case Column.TotalBatchCount:
                    break;

                case Column.Rerender:
                    return(info.renderDataIndex.ToString());

                default:
                    return("Missing");
                }
                return(null);
            }

            var canvasItem = args.item as CanvasTreeViewItem;

            if (canvasItem != null)
            {
                UISystemProfilerInfo info = canvasItem.info;
                switch ((Column)column)
                {
                case Column.BatchCount:
                    return(info.batchCount.ToString());

                case Column.TotalBatchCount:
                    return(info.totalBatchCount.ToString());

                case Column.TotalVertexCount:
                    return(info.totalVertexCount.ToString());

                case Column.GameObjectCount:
                    return(info.instanceIDsCount.ToString());

                case Column.VertexCount:
                case Column.BatchBreakingReason:
                case Column.InstanceIds:
                case Column.Element:
                    break;

                case Column.Rerender:
                    return(info.renderDataIndex + " : " + info.renderDataCount);

                default:
                    return("Missing");
                }
                return(null);
            }
            return(null);
        }
Esempio n. 6
0
        private static string FormatBatchBreakingReason(UISystemProfilerInfo info)
        {
            BatchBreakingReason batchBreakingReason = info.batchBreakingReason;

            switch (batchBreakingReason)
            {
            case BatchBreakingReason.NoBreaking:
            {
                string result = "NoBreaking";
                return(result);
            }

            case BatchBreakingReason.NotCoplanarWithCanvas:
            {
                string result = "Not Coplanar With Canvas";
                return(result);
            }

            case BatchBreakingReason.CanvasInjectionIndex:
            {
                string result = "Canvas Injection Index";
                return(result);
            }

            case (BatchBreakingReason)3:
            case (BatchBreakingReason)5:
            case (BatchBreakingReason)6:
            case (BatchBreakingReason)7:
            {
IL_33:
                string result;
                if (batchBreakingReason == BatchBreakingReason.DifferentTexture)
                {
                    result = "Different Texture";
                    return(result);
                }
                if (batchBreakingReason == BatchBreakingReason.DifferentA8TextureUsage)
                {
                    result = "Different A8 Texture Usage";
                    return(result);
                }
                if (batchBreakingReason == BatchBreakingReason.DifferentClipRect)
                {
                    result = "Different Clip Rect";
                    return(result);
                }
                if (batchBreakingReason != BatchBreakingReason.Unknown)
                {
                    throw new ArgumentOutOfRangeException();
                }
                result = "Unknown";
                return(result);
            }

            case BatchBreakingReason.DifferentMaterialInstance:
            {
                string result = "Different Material Instance";
                return(result);
            }

            case BatchBreakingReason.DifferentRectClipping:
            {
                string result = "Different Rect Clipping";
                return(result);
            }
            }
            goto IL_33;
        }
Esempio n. 7
0
        private string GetItemcontent(TreeView.RowGUIArgs args, int column)
        {
            string result;

            if (this.m_AllCanvasesItem != null && args.item.id == this.m_AllCanvasesItem.id)
            {
                switch (column)
                {
                case 2:
                    result = this.m_AllCanvasesItem.totalBatchCount.ToString();
                    return(result);

                case 4:
                    result = this.m_AllCanvasesItem.totalVertexCount.ToString();
                    return(result);

                case 6:
                    result = this.m_AllCanvasesItem.gameObjectCount.ToString();
                    return(result);
                }
                result = null;
            }
            else
            {
                UISystemProfilerTreeView.BatchTreeViewItem batchTreeViewItem = args.item as UISystemProfilerTreeView.BatchTreeViewItem;
                if (batchTreeViewItem != null)
                {
                    UISystemProfilerInfo info = batchTreeViewItem.info;
                    switch (column)
                    {
                    case 0:
                    case 1:
                    case 2:
                        break;

                    case 3:
                        result = info.vertexCount.ToString();
                        return(result);

                    case 4:
                        result = info.totalVertexCount.ToString();
                        return(result);

                    case 5:
                        if (info.batchBreakingReason != BatchBreakingReason.NoBreaking)
                        {
                            result = UISystemProfilerTreeView.FormatBatchBreakingReason(info);
                            return(result);
                        }
                        break;

                    case 6:
                        result = info.instanceIDsCount.ToString();
                        return(result);

                    case 7:
                        if (batchTreeViewItem.instanceIDs.Length <= 5)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int i = 0; i < batchTreeViewItem.instanceIDs.Length; i++)
                            {
                                if (i != 0)
                                {
                                    stringBuilder.Append(", ");
                                }
                                int num = batchTreeViewItem.instanceIDs[i];
                                UnityEngine.Object @object = EditorUtility.InstanceIDToObject(num);
                                if (@object == null)
                                {
                                    stringBuilder.Append(num);
                                }
                                else
                                {
                                    stringBuilder.Append(@object.name);
                                }
                            }
                            result = stringBuilder.ToString();
                            return(result);
                        }
                        result = string.Format("{0} objects", batchTreeViewItem.instanceIDs.Length);
                        return(result);

                    case 8:
                        result = info.renderDataIndex.ToString();
                        return(result);

                    default:
                        result = "Missing";
                        return(result);
                    }
                    result = null;
                }
                else
                {
                    UISystemProfilerTreeView.CanvasTreeViewItem canvasTreeViewItem = args.item as UISystemProfilerTreeView.CanvasTreeViewItem;
                    if (canvasTreeViewItem != null)
                    {
                        UISystemProfilerInfo info2 = canvasTreeViewItem.info;
                        switch (column)
                        {
                        case 0:
                        case 3:
                        case 5:
                        case 7:
                            result = null;
                            break;

                        case 1:
                            result = info2.batchCount.ToString();
                            break;

                        case 2:
                            result = info2.totalBatchCount.ToString();
                            break;

                        case 4:
                            result = info2.totalVertexCount.ToString();
                            break;

                        case 6:
                            result = info2.instanceIDsCount.ToString();
                            break;

                        case 8:
                            result = info2.renderDataIndex + " : " + info2.renderDataCount;
                            break;

                        default:
                            result = "Missing";
                            break;
                        }
                    }
                    else
                    {
                        result = null;
                    }
                }
            }
            return(result);
        }
Esempio n. 8
0
        protected override IList <TreeViewItem> BuildRows(TreeViewItem root)
        {
            this.profilerState.lastFrame = this.profilerState.profilerWindow.GetActiveVisibleFrameIndex();
            List <TreeViewItem>  list = new List <TreeViewItem>();
            IList <TreeViewItem> result;

            if (this.property == null || !this.property.frameDataReady)
            {
                result = list;
            }
            else
            {
                this.m_AllCanvasesItem = new UISystemProfilerTreeView.RootTreeViewItem();
                base.SetExpanded(this.m_AllCanvasesItem.id, true);
                root.AddChild(this.m_AllCanvasesItem);
                UISystemProfilerInfo[] uISystemProfilerInfo = this.property.GetUISystemProfilerInfo();
                int[] uISystemBatchInstanceIDs = this.property.GetUISystemBatchInstanceIDs();
                if (uISystemProfilerInfo != null)
                {
                    Dictionary <int, TreeViewItem> dictionary = new Dictionary <int, TreeViewItem>();
                    int num = 0;
                    UISystemProfilerInfo[] array = uISystemProfilerInfo;
                    for (int i = 0; i < array.Length; i++)
                    {
                        UISystemProfilerInfo info = array[i];
                        TreeViewItem         allCanvasesItem;
                        if (!dictionary.TryGetValue(info.parentId, out allCanvasesItem))
                        {
                            allCanvasesItem = this.m_AllCanvasesItem;
                            this.m_AllCanvasesItem.totalBatchCount  += info.totalBatchCount;
                            this.m_AllCanvasesItem.totalVertexCount += info.totalVertexCount;
                            this.m_AllCanvasesItem.gameObjectCount  += info.instanceIDsCount;
                        }
                        UISystemProfilerTreeView.BaseTreeViewItem baseTreeViewItem;
                        if (info.isBatch)
                        {
                            string displayName = "Batch " + num++;
                            baseTreeViewItem = new UISystemProfilerTreeView.BatchTreeViewItem(info, allCanvasesItem.depth + 1, displayName, uISystemBatchInstanceIDs);
                        }
                        else
                        {
                            string displayName = this.property.GetUISystemProfilerNameByOffset(info.objectNameOffset);
                            baseTreeViewItem = new UISystemProfilerTreeView.CanvasTreeViewItem(info, allCanvasesItem.depth + 1, displayName);
                            num = 0;
                            dictionary[info.objectInstanceId] = baseTreeViewItem;
                        }
                        if (!base.IsExpanded(allCanvasesItem.id))
                        {
                            if (!allCanvasesItem.hasChildren)
                            {
                                allCanvasesItem.children = TreeView.CreateChildListForCollapsedParent();
                            }
                        }
                        else
                        {
                            allCanvasesItem.AddChild(baseTreeViewItem);
                        }
                    }
                    this.m_Comparer.Col = UISystemProfilerTreeView.Column.Element;
                    if (base.multiColumnHeader.sortedColumnIndex != -1)
                    {
                        this.m_Comparer.Col = (UISystemProfilerTreeView.Column)base.multiColumnHeader.sortedColumnIndex;
                    }
                    this.m_Comparer.isAscending = base.multiColumnHeader.GetColumn((int)this.m_Comparer.Col).sortedAscending;
                    this.SetupRows(this.m_AllCanvasesItem, list);
                }
                result = list;
            }
            return(result);
        }