Example #1
0
        private TreelistView.Node AddDrawcall(FetchDrawcall drawcall, TreelistView.Node root)
        {
            if (EventBrowser.ShouldHide(m_Core, drawcall))
            {
                return(null);
            }

            UInt32 eventNum = drawcall.eventID;

            TreelistView.Node drawNode = null;

            string nameWithID = drawcall.name + " DrawID: #" + drawcall.drawcallID;

            if (drawcall.children.Length > 0)
            {
                //drawNode = MakeNode(eventNum, GetEndEventID(drawcall), drawcall.drawcallID, GetEndDrawID(drawcall), drawcall.name, 0.0);
                drawNode = MakeNode(eventNum, GetEndEventID(drawcall), drawcall.drawcallID, GetEndDrawID(drawcall), nameWithID, 0.0);
            }
            else
            {
                drawNode = MakeNode(eventNum, drawcall.drawcallID, nameWithID, 0.0);
            }
            //drawNode = MakeNode(eventNum, drawcall.drawcallID, drawcall.name, 0.0);


            if (m_Core.Config.EventBrowser_ApplyColours)
            {
                // if alpha isn't 0, assume the colour is valid
                if ((drawcall.flags & (DrawcallFlags.PushMarker | DrawcallFlags.SetMarker)) > 0 && drawcall.markerColour[3] > 0.0f)
                {
                    float red   = drawcall.markerColour[0];
                    float green = drawcall.markerColour[1];
                    float blue  = drawcall.markerColour[2];
                    float alpha = drawcall.markerColour[3];

                    drawNode.TreeLineColor = drawcall.GetColor();
                    drawNode.TreeLineWidth = 3.0f;

                    if (m_Core.Config.EventBrowser_ColourEventRow)
                    {
                        drawNode.BackColor = drawcall.GetColor();
                        drawNode.ForeColor = drawcall.GetTextColor(eventView.ForeColor);
                    }
                }
            }

            DeferredEvent def = new DeferredEvent();

            def.eventID = eventNum;
            def.marker  = (drawcall.flags & DrawcallFlags.SetMarker) != 0;

            drawNode.Tag = def;

            if (drawcall.children != null && drawcall.children.Length > 0)
            {
                for (int i = 0; i < drawcall.children.Length; i++)
                {
                    AddDrawcall(drawcall.children[i], drawNode);

                    if (i > 0 && drawNode.Nodes.Count >= 2 &&
                        (drawcall.children[i - 1].flags & DrawcallFlags.SetMarker) > 0)
                    {
                        DeferredEvent markerTag = drawNode.Nodes[drawNode.Nodes.Count - 2].Tag as DeferredEvent;
                        DeferredEvent drawTag   = drawNode.Nodes.LastNode.Tag as DeferredEvent;
                        markerTag.eventID = drawTag.eventID;
                    }
                }

                bool found = false;

                for (int i = drawNode.Nodes.Count - 1; i >= 0; i--)
                {
                    DeferredEvent t = drawNode.Nodes[i].Tag as DeferredEvent;
                    if (t != null && !t.marker)
                    {
                        drawNode.Tag = drawNode.Nodes[i].Tag;
                        found        = true;
                        break;
                    }
                }

                if (!found && !drawNode.Nodes.IsEmpty())
                {
                    drawNode.Tag = drawNode.Nodes.LastNode.Tag;
                }
            }

            if (drawNode.Nodes.IsEmpty() && (drawcall.flags & DrawcallFlags.PushMarker) != 0 && m_Core.Config.EventBrowser_HideEmpty)
            {
                return(null);
            }

            root.Nodes.Add(drawNode);

            return(drawNode);
        }
Example #2
0
        // Some viewers we only allow one to exist at once, so we keep the instance here.
        public EventBrowser GetEventBrowser()
        {
            if (m_EventBrowser == null || m_EventBrowser.IsDisposed)
            {
                m_EventBrowser = new EventBrowser(this);
                AddLogViewer(m_EventBrowser);
            }

            return m_EventBrowser;
        }
Example #3
0
        private Section GatherEvents(FetchDrawcall[] draws)
        {
            var sections = new List <List <FetchDrawcall> >();

            foreach (var d in draws)
            {
                if ((d.flags & (DrawcallFlags.SetMarker | DrawcallFlags.Present)) > 0)
                {
                    continue;
                }

                if (EventBrowser.ShouldHide(m_Core, d))
                {
                    continue;
                }

                bool newSection = ((d.flags & (DrawcallFlags.PushMarker | DrawcallFlags.MultiDraw)) > 0 || sections.Count == 0);
                if (!newSection)
                {
                    var lastSection = sections.Last();

                    if (lastSection.Count == 1 && (lastSection[0].flags & (DrawcallFlags.PushMarker | DrawcallFlags.MultiDraw)) > 0)
                    {
                        newSection = true;
                    }
                }

                if (newSection)
                {
                    sections.Add(new List <FetchDrawcall>());
                }

                sections.Last().Add(d);
            }

            Section ret = new Section();

            ret.subsections = new List <Section>();

            foreach (var s in sections)
            {
                Section sec = null;

                if (s.Count == 1 && (s[0].flags & (DrawcallFlags.PushMarker | DrawcallFlags.MultiDraw)) > 0)
                {
                    sec = GatherEvents(s[0].children);
                    if (m_Core.Config.EventBrowser_ApplyColours)
                    {
                        sec.color     = s[0].GetColor();
                        sec.textcolor = s[0].GetTextColor(Color.Black);
                    }
                    else
                    {
                        sec.color     = Color.Transparent;
                        sec.textcolor = Color.Black;
                    }
                    sec.Name = s[0].name;
                }
                else
                {
                    sec       = new Section();
                    sec.draws = s;
                    for (int i = 0; i < sec.draws.Count; i++)
                    {
                        sec.lastPoss.Add(0.0f);
                        sec.lastUsage.Add(false);
                        sec.lastVisible.Add(false);
                    }
                }

                ret.subsections.Add(sec);
            }

            return(ret);
        }