当前位置: 首页>>代码示例>>C#>>正文


C# renderdoc.FetchDrawcall类代码示例

本文整理汇总了C#中renderdoc.FetchDrawcall的典型用法代码示例。如果您正苦于以下问题:C# FetchDrawcall类的具体用法?C# FetchDrawcall怎么用?C# FetchDrawcall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FetchDrawcall类属于renderdoc命名空间,在下文中一共展示了FetchDrawcall类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddDebugMessages

        public void AddDebugMessages(FetchDrawcall[] drawcalls)
        {
            foreach (var draw in drawcalls)
            {
                if (draw.context != m_Core.FrameInfo[m_Core.CurFrame].immContextId)
                    continue;

                if(draw.children.Length > 0)
                    AddDebugMessages(draw.children);

                if (draw.debugMessages != null)
                {
                    foreach (var msg in draw.debugMessages)
                    {
                        int i = m_Messages.Count;
                        m_VisibleMessages.Add(i);
                        m_Messages.Add(new DebugMessage(i, draw.eventID, msg));
                    }
                }
            }
        }
开发者ID:Lonesled,项目名称:renderdoc,代码行数:21,代码来源:DebugMessages.cs

示例2: PassEquivalent

        // used to determine if two drawcalls can be considered in the same 'pass',
        // ie. writing to similar targets, same type of call, etc.
        //
        // When a log has no markers, this is used to group up drawcalls into fake markers
        private bool PassEquivalent(FetchDrawcall a, FetchDrawcall b)
        {
            // executing command lists can have children
            if(a.children.Length > 0 || b.children.Length > 0)
                return false;

            // don't group draws and compute executes
            if ((a.flags & DrawcallFlags.Dispatch) != (b.flags & DrawcallFlags.Dispatch))
                return false;

            // don't group present with anything
            if ((a.flags & DrawcallFlags.Present) != (b.flags & DrawcallFlags.Present))
                return false;

            // don't group things run on different multithreaded contexts
            if(a.context != b.context)
                return false;

            // don't group things with different depth outputs
            if (a.depthOut != b.depthOut)
                return false;

            int numAOuts = 0, numBOuts = 0;
            for (int i = 0; i < 8; i++)
            {
                if (a.outputs[i] != ResourceId.Null) numAOuts++;
                if (b.outputs[i] != ResourceId.Null) numBOuts++;
            }

            int numSame = 0;

            if (a.depthOut != ResourceId.Null)
            {
                numAOuts++;
                numBOuts++;
                numSame++;
            }

            for (int i = 0; i < 8; i++)
            {
                if (a.outputs[i] != ResourceId.Null)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        if (a.outputs[i] == b.outputs[j])
                        {
                            numSame++;
                            break;
                        }
                    }
                }
                else if (b.outputs[i] != ResourceId.Null)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        if (a.outputs[j] == b.outputs[i])
                        {
                            numSame++;
                            break;
                        }
                    }
                }
            }

            // use a kind of heuristic to group together passes where the outputs are similar enough.
            // could be useful for example if you're rendering to a gbuffer and sometimes you render
            // without one target, but the draws are still batched up.
            if (numSame > Math.Max(numAOuts, numBOuts) / 2 && Math.Max(numAOuts, numBOuts) > 1)
                return true;

            if (numSame == Math.Max(numAOuts, numBOuts))
                return true;

            return false;
        }
开发者ID:Clever-Boy,项目名称:renderdoc,代码行数:79,代码来源:Core.cs

示例3: AddDrawcall

        private TreelistView.Node AddDrawcall(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;
            TreelistView.Node drawNode = null;

            if(drawcall.children.Length > 0)
                drawNode = MakeNode(eventNum, GetEndEventID(drawcall), drawcall.drawcallID, drawcall.name, 0.0);
            else
                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();
                        if (drawcall.ShouldUseWhiteText())
                            drawNode.ForeColor = Color.White;
                    }
                }
            }

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

            if (drawcall.context != m_Core.FrameInfo.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++)
                {
                    AddDrawcall(drawcall.children[i], drawNode);

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

                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;
        }
开发者ID:Cry-Filami,项目名称:renderdoc,代码行数:97,代码来源:EventBrowser.cs

示例4: FindDraw

        private void FindDraw(Point p, Section s,
            ref FetchDrawcall left, ref float dleft, ref bool uleft,
            ref FetchDrawcall right, ref float dright, ref bool uright)
        {
            if (s == null)
                return;

            var rect = s.lastRect;
            rect.Y = 0;
            rect.Height = 10000;

            if (s.subsections != null)
            {
                foreach (var sub in s.subsections)
                {
                    FindDraw(p, sub, ref left, ref dleft, ref uleft, ref right, ref dright, ref uright);

                    if(left != null && right != null)
                        return;
                }
            }

            if (rect.Contains(p))
            {
                if (s.draws == null || s.draws.Count == 0)
                    return;

                for(int i=0; i < s.lastPoss.Count; i++)
                {
                    if (s.lastVisible[i])
                    {
                        if (s.lastPoss[i] <= p.X)
                        {
                            if (
                                // not found left
                                left == null ||
                                // this left is closer and as usage-y, or we don't have a usage-y one yet
                               (s.lastPoss[i] > dleft && s.lastUsage[i] == uleft) ||
                                // this left is WAY closer
                               (s.lastPoss[i] > dleft + 20.0f) ||
                                // this left is more usage-y
                               (s.lastUsage[i] && !uleft)
                              )
                            {
                                dleft = s.lastPoss[i];
                                uleft = s.lastUsage[i];
                                left = s.draws[i];
                            }
                        }

                        if (s.lastPoss[i] > p.X)
                        {
                            if (
                                // not found right
                                right == null ||
                                // this right is closer and as usage-y, or we don't have a usage-y one yet
                               (s.lastPoss[i] < dright && s.lastUsage[i] == uright) ||
                                // this right is WAY closer
                               (s.lastPoss[i] < dright - 20.0f) ||
                                // this right is more usage-y
                               (s.lastUsage[i] && !uright)
                              )
                            {
                                dright = s.lastPoss[i];
                                uright = s.lastUsage[i];
                                right = s.draws[i];
                            }
                        }
                    }
                }

                if (left != null && right != null)
                    return;
            }
        }
开发者ID:Anteru,项目名称:renderdoc,代码行数:75,代码来源:TimelineBar.cs

示例5: AddDrawcall

        private TreelistView.Node AddDrawcall(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;
            TreelistView.Node drawNode = MakeNode(eventNum, drawcall.drawcallID, drawcall.name, 0.0);

            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++)
                {
                    AddDrawcall(drawcall.children[i], drawNode);

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

                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;
        }
开发者ID:ksenglee,项目名称:renderdoc,代码行数:71,代码来源:EventBrowser.cs

示例6: GetExportDrawcallString

        private string GetExportDrawcallString(int indent, bool firstchild, FetchDrawcall drawcall)
        {
            string prefix = new string(' ', indent * 2 - (firstchild ? 1 : 0));
            if(firstchild)
                prefix += '\\';

            return String.Format("{0}- {1}", prefix, drawcall.name);
        }
开发者ID:Nexuapex,项目名称:renderdoc,代码行数:8,代码来源:EventBrowser.cs

示例7: GetDrawTime

        private double GetDrawTime(FetchDrawcall drawcall)
        {
            if (drawcall.children.Length > 0)
            {
                double total = 0.0;

                foreach (FetchDrawcall c in drawcall.children)
                {
                    double f = GetDrawTime(c);
                    if(f >= 0)
                        total += f;
                }

                return total;
            }
            else if (m_Times.ContainsKey(drawcall.eventID))
            {
                return m_Times[drawcall.eventID][0].value.d;
            }

            return -1.0;
        }
开发者ID:Nexuapex,项目名称:renderdoc,代码行数:22,代码来源:EventBrowser.cs

示例8: AddDrawcall

        private TreelistView.Node AddDrawcall(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;
            TreelistView.Node drawNode = null;

            if(drawcall.children.Length > 0)
                drawNode = MakeNode(eventNum, GetEndEventID(drawcall), drawcall.drawcallID, GetEndDrawID(drawcall), drawcall.name, 0.0);
            else
                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;
        }
开发者ID:Nexuapex,项目名称:renderdoc,代码行数:82,代码来源:EventBrowser.cs

示例9: RemoveMarkerColors

        private void RemoveMarkerColors(FetchDrawcall[] draws)
        {
            for (int i = 0; i < draws.Length; i++)
            {
                draws[i].markerColour[0] = 0.0f;
                draws[i].markerColour[1] = 0.0f;
                draws[i].markerColour[2] = 0.0f;
                draws[i].markerColour[3] = 0.0f;

                RemoveMarkerColors(draws[i].children);
            }
        }
开发者ID:Anteru,项目名称:renderdoc,代码行数:12,代码来源:Core.cs

示例10: HasValidMarkerColors

        // because some engines (*cough*unreal*cough*) provide a valid marker colour of
        // opaque black for every marker, instead of transparent black (i.e. just 0) we
        // want to check for that case and remove the colors, instead of displaying all
        // the markers as black which is not what's intended.
        //
        // Valid marker colors = has at least one color somewhere that isn't (0.0, 0.0, 0.0, 1.0)
        //                       or (0.0, 0.0, 0.0, 0.0)
        //
        // This will fail if no marker colors are set anyway, but then removing them is
        // harmless.
        private bool HasValidMarkerColors(FetchDrawcall[] draws)
        {
            if (draws.Length == 0)
                return false;

            foreach (var d in draws)
            {
                if (d.markerColour[0] != 0.0f ||
                     d.markerColour[1] != 0.0f ||
                     d.markerColour[2] != 0.0f ||
                     (d.markerColour[3] != 1.0f && d.markerColour[3] != 0.0f))
                {
                    return true;
                }

                if (HasValidMarkerColors(d.children))
                    return true;
            }

            return false;
        }
开发者ID:Anteru,项目名称:renderdoc,代码行数:31,代码来源:Core.cs

示例11: AddFrameDrawcalls

        private void AddFrameDrawcalls(TreelistView.Node frame, FetchDrawcall[] drawcalls)
        {
            eventView.BeginUpdate();

            frame["Duration"] = -1.0;

            DeferredEvent startEv = new DeferredEvent();
            startEv.frameID = m_Core.CurFrame;
            startEv.eventID = 0;

            if(frame.Nodes.Count == 0)
                frame.Nodes.Add(MakeNode(0, 0, "Frame Start", -1.0)).Tag = startEv;

            for (int i = 0; i < drawcalls.Length; i++)
            {
                TreelistView.Node d = frame.Nodes.Count > (i + 1) ? frame.Nodes[i + 1] : null;

                TreelistView.Node newD = AddDrawcall(d, drawcalls[i], frame);

                if (newD != null)
                {
                    d = newD;

                    if ((double)d["Duration"] > 0.0)
                        frame["Duration"] = Math.Max(0.0, (double)frame["Duration"]) + (double)d["Duration"];
                }
            }

            frame.Tag = frame.Nodes.LastNode.Tag;

            eventView.EndUpdate();
        }
开发者ID:n1nj4n,项目名称:renderdoc,代码行数:32,代码来源:EventBrowser.cs

示例12: AddDrawcall

        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;
        }
开发者ID:n1nj4n,项目名称:renderdoc,代码行数:66,代码来源:EventBrowser.cs

示例13: PopulateDraws

        private void PopulateDraws(ref Dictionary<Int64, FetchDrawcall> map, FetchDrawcall[] draws)
        {
            if (draws.Length == 0) return;

            foreach (var d in draws)
            {
                map.Add((Int64)d.eventID, d);
                PopulateDraws(ref map, d.children);
            }
        }
开发者ID:nsurface,项目名称:renderdoc,代码行数:10,代码来源:ReplayRenderer.cs

示例14: FixupDraws

        private void FixupDraws(Dictionary<Int64, FetchDrawcall> map, FetchDrawcall[] draws)
        {
            if (draws.Length == 0) return;

            foreach (var d in draws)
            {
                if (d.previousDrawcall != 0 && map.ContainsKey(d.previousDrawcall)) d.previous = map[d.previousDrawcall];
                if (d.nextDrawcall != 0 && map.ContainsKey(d.nextDrawcall)) d.next = map[d.nextDrawcall];
                if (d.parentDrawcall != 0 && map.ContainsKey(d.parentDrawcall)) d.parent = map[d.parentDrawcall];

                FixupDraws(map, d.children);
            }
        }
开发者ID:nsurface,项目名称:renderdoc,代码行数:13,代码来源:ReplayRenderer.cs

示例15: CountContributingEvents

        private void CountContributingEvents(FetchDrawcall draw, ref uint drawCount, ref uint dispatchCount, ref uint diagnosticCount)
        {
            const uint diagnosticMask = (uint)DrawcallFlags.SetMarker | (uint)DrawcallFlags.PushMarker | (uint)DrawcallFlags.PopMarker;
            uint diagnosticMasked = (uint)draw.flags & diagnosticMask;

            if (diagnosticMasked != 0)
                diagnosticCount += 1;

            if ((draw.flags & DrawcallFlags.Drawcall) != 0)
                drawCount += 1;

            if ((draw.flags & DrawcallFlags.Dispatch) != 0)
                dispatchCount += 1;

            if (draw.children != null)
            {
                foreach (var c in draw.children)
                    CountContributingEvents(c, ref drawCount, ref dispatchCount, ref diagnosticCount);
            }
        }
开发者ID:kvark,项目名称:renderdoc,代码行数:20,代码来源:StatisticsViewer.cs


注:本文中的renderdoc.FetchDrawcall类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。