コード例 #1
0
        public ComplexDynamicMesh(DirectXCanvas canvas, int chunkCount = 20)
        {
            double scaleX = 1.0 / chunkCount;

            for (int i = 0; i < chunkCount; ++i)
            {
                DynamicMesh mesh = canvas.CreateMesh();
                mesh.LocalTransform = new Matrix(scaleX, 0.0, 0.0, 1.0, -i / chunkCount, 0.0);
                DIPs.Add(mesh);
            }
        }
コード例 #2
0
        public override void BuildMesh(DirectX.DirectXCanvas canvas, ThreadScroll scroll)
        {
            DirectX.DynamicMesh builder = canvas.CreateMesh();
            builder.Geometry = DirectX.Mesh.GeometryType.Lines;

            foreach (EventFrame frame in Group.MainThread.Events)
            {
                double x = scroll.TimeToUnit(frame.Header).Left;
                builder.AddLine(new Point(x, 0.0), new Point(x, 1.0), SplitLines);
            }
            BackgroundMeshLines = builder.Freeze(canvas.RenderDevice);

            DirectX.DynamicMesh builderHeader = canvas.CreateMesh();
            builderHeader.AddRect(new Rect(0.0, 0.0, 1.0, (Height - RenderParams.BaseMargin) / scroll.Height), new Color[] { GradientTop, GradientTop, GradientBottom, GradientBottom });
            BackgroundMeshTris = builderHeader.Freeze(canvas.RenderDevice);
        }
コード例 #3
0
        void BuildMeshNode(DirectX.DynamicMesh builder, ThreadScroll scroll, EventNode node, int level)
        {
            if (level == MaxDepth)
            {
                return;
            }

            Interval interval = scroll.TimeToUnit(node.Entry);

            double y = (double)level / MaxDepth;
            double h = 1.0 / MaxDepth;

            builder.AddRect(new Rect(interval.Left, y, interval.Width, h), node.Description.Color);

            foreach (EventNode child in node.Children)
            {
                BuildMeshNode(builder, scroll, child, level + 1);
            }
        }
コード例 #4
0
ファイル: DirectXCanvas.xaml.cs プロジェクト: weynaa/optick
        public DynamicMesh CreateMesh(MeshType type = MeshType.Poly)
        {
            DynamicMesh mesh = new DynamicMesh(RenderDevice);

            switch (type)
            {
            case MeshType.Poly:
                mesh.Fragment   = DefaultFragment;
                mesh.Projection = Mesh.ProjectionType.Unit;
                break;

            case MeshType.Text:
                mesh.Fragment   = TextFragment;
                mesh.Projection = Mesh.ProjectionType.Pixel;
                break;

            default:
                break;
            }

            return(mesh);
        }
コード例 #5
0
ファイル: ThreadRow.cs プロジェクト: withdrawmemory/optick
        public override void BuildMesh(DirectX.DirectXCanvas canvas, ThreadScroll scroll)
        {
            DirectX.DynamicMesh builder = canvas.CreateMesh();
            builder.Geometry = DirectX.Mesh.GeometryType.Lines;

            double headerHeight = 1.0;            //(Height - RenderParams.BaseMargin) / scroll.Height;

            // Adding Tickers
            if (EnableTickers)
            {
                for (double tick = Math.Ceiling(scroll.TimeSlice.StartMS); tick < Math.Ceiling(scroll.TimeSlice.FinishMS); tick += 1.0)
                {
                    double longX = scroll.TimeToUnit(new Tick {
                        Start = Durable.MsToTick(tick)
                    });
                    builder.AddLine(new Point(longX, headerHeight * 3.0 / 6.0), new Point(longX, headerHeight), TickColor);

                    double medX = scroll.TimeToUnit(new Tick {
                        Start = Durable.MsToTick(tick + 0.5)
                    });
                    builder.AddLine(new Point(medX, headerHeight * 4.0 / 6.0), new Point(medX, headerHeight), TickColor);


                    for (double miniTick = 0.1; miniTick < 1.0; miniTick += 0.1)
                    {
                        double miniX = scroll.TimeToUnit(new Tick {
                            Start = Durable.MsToTick(tick + miniTick)
                        });
                        builder.AddLine(new Point(miniX, headerHeight * 5.0 / 6.0), new Point(miniX, headerHeight), TickColor);
                    }
                }
            }
            BackgroundMeshLines = builder.Freeze(canvas.RenderDevice);

            DirectX.DynamicMesh builderHeader = canvas.CreateMesh();
            builderHeader.AddRect(new Rect(0.0, 0.0, 1.0, headerHeight), new Color[] { GradientTop, GradientTop, GradientBottom, GradientBottom });
            BackgroundMeshTris = builderHeader.Freeze(canvas.RenderDevice);
        }
コード例 #6
0
        public override void BuildMesh(DirectX.DirectXCanvas canvas, ThreadScroll scroll)
        {
            // Build Mesh
            DirectX.DynamicMesh builder         = canvas.CreateMesh();
            DirectX.DynamicMesh syncBuilder     = canvas.CreateMesh();
            DirectX.DynamicMesh syncWorkBuilder = canvas.CreateMesh();

            if (EventData.Sync != null && EventData.Sync.Intervals != null)
            {
                SyncReason stallReason    = SyncReason.SyncReasonCount;
                long       stallFrom      = 0;
                int        frameSyncIndex = 0;

                for (int i = 0; i < EventData.Sync.Intervals.Count; i++)
                {
                    SyncInterval sync = EventData.Sync.Intervals[i];

                    Interval workInterval = scroll.TimeToUnit(sync);

                    //draw work
                    int coreColorIndex = (int)sync.Core;
                    coreColorIndex = coreColorIndex % WorkColors.Length;
                    Color WorkColor = WorkColors[coreColorIndex];
                    syncWorkBuilder.AddRect(new Rect(workInterval.Left, RenderParams.BaseMargin / Height, workInterval.Right - workInterval.Left, SyncLineHeight / Height), WorkColor);

                    if (i == 0)
                    {
                        stallReason = sync.Reason;
                        stallFrom   = sync.Finish;
                        continue;
                    }

                    long workStart  = sync.Start;
                    long workFinish = sync.Finish;

                    while (frameSyncIndex < EventData.Events.Count && EventData.Events[frameSyncIndex].Finish < stallFrom)
                    {
                        ++frameSyncIndex;
                    }

                    //Ignoring all the waiting outside marked work to simplify the view
                    if (frameSyncIndex < EventData.Events.Count && EventData.Events[frameSyncIndex].Start <= workStart)
                    {
                        Interval syncInterval = scroll.TimeToUnit(new Durable(stallFrom, workStart));

                        double syncWidth = syncInterval.Right - syncInterval.Left;
                        if (syncWidth <= 0)
                        {
                            syncWidth = 0.1;
                        }

                        // draw sleep
                        Color waitColor = IsUserInitiatedSync(stallReason) ? SynchronizationColorUser : SynchronizationColor;
                        syncBuilder.AddRect(new Rect(syncInterval.Left, RenderParams.BaseMargin / Height, syncWidth, SyncLineHeight / Height), waitColor);
                    }

                    stallFrom   = workFinish;
                    stallReason = sync.Reason;
                }
            }

            foreach (EventFrame frame in EventData.Events)
            {
                Durable interval = Group.Board.TimeSlice;

                foreach (EventNode node in frame.CategoriesTree.Children)
                {
                    BuildMeshNode(builder, scroll, node, 0);
                }
            }

            Mesh         = builder.Freeze(canvas.RenderDevice);
            SyncMesh     = syncBuilder.Freeze(canvas.RenderDevice);
            SyncWorkMesh = syncWorkBuilder.Freeze(canvas.RenderDevice);

            CallstackMeshPolys            = canvas.CreateMesh();
            CallstackMeshPolys.Projection = Mesh.ProjectionType.Pixel;

            CallstackMeshLines            = canvas.CreateMesh();
            CallstackMeshLines.Geometry   = Mesh.GeometryType.Lines;
            CallstackMeshLines.Projection = Mesh.ProjectionType.Pixel;
        }