コード例 #1
0
ファイル: EnvironmentEditor.cs プロジェクト: Anteru/renderdoc
        public void AddModification(EnvironmentModification mod, bool silent)
        {
            TreelistView.Node node = new TreelistView.Node();
            int idx = ExistingIndex();
            if (idx >= 0)
                node = variables.Nodes[idx];

            if (mod.variable.Trim() == "")
            {
                if(!silent)
                    MessageBox.Show("Environment variable cannot be just whitespace", "Invalid variable", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            variables.BeginUpdate();

            if (idx < 0)
                variables.Nodes.Add(node);

            node.SetData(new object[] { mod.variable, mod.GetTypeString(), mod.value });
            node.Tag = mod;

            variables.EndUpdate();

            variables.NodesSelection.Clear();
            variables.NodesSelection.Add(node);

            varName.AutoCompleteCustomSource.Clear();
            for (int i = 0; i < variables.Nodes.Count; i++)
                varName.AutoCompleteCustomSource.Add((string)variables.Nodes[i][0]);
        }
コード例 #2
0
        public void AddModification(EnvironmentModification mod, bool silent)
        {
            TreelistView.Node node = new TreelistView.Node();
            int idx = ExistingIndex();

            if (idx >= 0)
            {
                node = variables.Nodes[idx];
            }

            if (mod.variable.Trim() == "")
            {
                if (!silent)
                {
                    MessageBox.Show("Environment variable cannot be just whitespace", "Invalid variable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return;
            }

            variables.BeginUpdate();

            if (idx < 0)
            {
                variables.Nodes.Add(node);
            }

            node.SetData(new object[] { mod.variable, mod.GetTypeString(), mod.value });
            node.Tag = mod;

            variables.EndUpdate();

            variables.NodesSelection.Clear();
            variables.NodesSelection.Add(node);

            varName.AutoCompleteCustomSource.Clear();
            for (int i = 0; i < variables.Nodes.Count; i++)
            {
                varName.AutoCompleteCustomSource.Add((string)variables.Nodes[i][0]);
            }
        }
コード例 #3
0
        private TreelistView.Node AddDrawcall(TreelistView.Node existing, FetchDrawcall drawcall, TreelistView.Node root)
        {
            if (m_Core.Config.EventBrowser_HideEmpty)
            {
                if ((drawcall.children == null || drawcall.children.Length == 0) && (drawcall.flags & DrawcallFlags.PushMarker) != 0)
                {
                    return(null);
                }
            }

            UInt32 eventNum = drawcall.eventID;
            double duration = drawcall.duration;

            TreelistView.Node drawNode = MakeNode(eventNum, drawcall.drawcallID, drawcall.name, duration);

            if (existing != null)
            {
                existing.SetData(drawNode.GetData());
                drawNode = existing;
            }
            else
            {
                root.Nodes.Add(drawNode);
            }

            DeferredEvent def = new DeferredEvent();

            def.frameID = m_Core.CurFrame;
            def.eventID = eventNum;

            if (drawcall.context != m_Core.FrameInfo[m_Core.CurFrame].immContextId)
            {
                def.defCtx    = drawcall.context;
                def.lastDefEv = drawcall.eventID;

                FetchDrawcall parent = drawcall.parent;
                while (!parent.name.Contains("ExecuteCommand"))
                {
                    parent = parent.parent;
                }

                def.eventID = parent.eventID - 1;

                def.firstDefEv = parent.children[0].eventID;
                if (parent.children[0].events.Length > 0)
                {
                    def.firstDefEv = parent.children[0].events[0].eventID;
                }
            }

            drawNode.Tag = def;

            if (drawcall.children != null && drawcall.children.Length > 0)
            {
                for (int i = 0; i < drawcall.children.Length; i++)
                {
                    TreelistView.Node d = drawNode.Nodes.Count > i ? drawNode.Nodes[i] : null;

                    AddDrawcall(d, drawcall.children[i], drawNode);

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

                    if ((double)drawNode.Nodes[i]["Duration"] > 0.0)
                    {
                        drawNode["Duration"] = Math.Max(0.0, (double)drawNode["Duration"]) + (double)drawNode.Nodes[i]["Duration"];
                    }
                }

                drawNode.Tag = drawNode.Nodes.LastNode.Tag;
            }

            return(drawNode);
        }
コード例 #4
0
ファイル: EventBrowser.cs プロジェクト: Paxi1337/renderdoc
        private TreelistView.Node AddDrawcall(TreelistView.Node existing, FetchDrawcall drawcall, TreelistView.Node root, Dictionary <uint, List <CounterResult> > times)
        {
            if (m_Core.Config.EventBrowser_HideEmpty)
            {
                if ((drawcall.children == null || drawcall.children.Length == 0) && (drawcall.flags & DrawcallFlags.PushMarker) != 0)
                {
                    return(null);
                }
            }

            UInt32 eventNum = drawcall.eventID;
            double duration = 0.0;

            if (times != null && times.ContainsKey(eventNum))
            {
                duration = times[eventNum][0].value.d;
            }
            TreelistView.Node drawNode = MakeNode(eventNum, drawcall.drawcallID, drawcall.name, duration);

            if (existing != null)
            {
                existing.SetData(drawNode.GetData());
                drawNode = existing;
            }
            else
            {
                root.Nodes.Add(drawNode);
            }

            DeferredEvent def = new DeferredEvent();

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

            if (drawcall.context != m_Core.FrameInfo[m_Core.CurFrame].immContextId)
            {
                def.defCtx    = drawcall.context;
                def.lastDefEv = drawcall.eventID;

                FetchDrawcall parent = drawcall.parent;
                while (!parent.name.Contains("ExecuteCommand"))
                {
                    parent = parent.parent;
                }

                def.eventID = parent.eventID - 1;

                def.firstDefEv = parent.children[0].eventID;
                if (parent.children[0].events.Length > 0)
                {
                    def.firstDefEv = parent.children[0].events[0].eventID;
                }
            }

            drawNode.Tag = def;

            if (drawcall.children != null && drawcall.children.Length > 0)
            {
                for (int i = 0; i < drawcall.children.Length; i++)
                {
                    TreelistView.Node d = drawNode.Nodes.Count > i ? drawNode.Nodes[i] : null;

                    AddDrawcall(d, drawcall.children[i], drawNode, times);

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

                    if (i < drawNode.Nodes.Count && (double)drawNode.Nodes[i]["Duration"] > 0.0)
                    {
                        drawNode["Duration"] = Math.Max(0.0, (double)drawNode["Duration"]) + (double)drawNode.Nodes[i]["Duration"];
                    }
                }

                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.Tag = drawNode.Nodes.LastNode.Tag;
                }
            }

            return(drawNode);
        }