コード例 #1
0
        private static void OutputLog(MigotoData data, FileInfo file)
        {
            var outputFile = file.ChangeExt(CSV.Extension);

            using var output = outputFile.TryOpenWrite(ui);
            if (output == null)
            {
                return;
            }
            LogWriter.Write(data, output);
            ui.Event("Export Log complete");
        }
コード例 #2
0
        public AutoConverter(DirectoryInfo root, MigotoData data, IUserInterface ui)
        {
            this.data            = data;
            this.ui              = ui;
            frameAnalysisWatcher = new FileSystemWatcher(root.FullName, "FrameAnalysis-*")
            {
                NotifyFilter        = NotifyFilters.DirectoryName,
                EnableRaisingEvents = true
            };
            frameAnalysisWatcher.Created += frameAnalyisCreated = IOHelpers.Handler <DirectoryInfo>(FrameAnalysisCreated);

            iniFileWatcher = new FileSystemWatcher(root.FullName, $"*{ConfigFile.Extension}")
            {
                NotifyFilter        = NotifyFilters.FileName,
                EnableRaisingEvents = true
            };
            iniFileWatcher.Created += configCreated = IOHelpers.Handler <FileInfo>(ConfigCreated);
            iniFileWatcher.Changed += configChanged = IOHelpers.Handler <FileInfo>(ConfigChanged);
        }
コード例 #3
0
        public static void Write(MigotoData data, StreamWriter output)
        {
            if (data.FrameAnalysis == null)
            {
                return;
            }

            var frames        = data.FrameAnalysis.Frames;
            var columnGroups  = data.ColumnGroups;
            var shaderColumns = data.ShaderColumns;

            var logicSplit = new Regex(@"(?<! )(?=post)");

            var columns = new List <IColumns>();

            if (frames.Count > 1)
            {
                columns.Add(new Column("Frame", dc => dc.Owner?.Index));
            }

            columns.Add(new Column("Draw", dc => dc.Index));

            if (columnGroups.HasFlag(DrawCallColumns.VB))
            {
                columns.AddRange(new IColumns[] {
                    new UintColumn("vb_", dc => dc.Draw?.StartVertex),
                    new UintColumn("vb#", dc => dc.Draw?.VertexCount),
                    new AssetColumnSet("vb", dc => dc.SetVertexBuffers, IASetVertexBuffers.UsedSlots),
                });
            }

            if (columnGroups.HasFlag(DrawCallColumns.IB))
            {
                columns.AddRange(new IColumns[] {
                    new UintColumn("ib_", dc => dc.Draw?.StartIndex),
                    new UintColumn("ib#", dc => dc.Draw?.IndexCount),
                    new HashColumn("ib", dc => dc.SetIndexBuffer?.Buffer),
                });
            }

            if (columnGroups.HasFlag(DrawCallColumns.VB) || columnGroups.HasFlag(DrawCallColumns.IB))
            {
                columns.AddRange(new IColumns[] {
                    new UintColumn("inst_", dc => dc.Draw?.StartInstance),
                    new UintColumn("inst#", dc => dc.Draw?.InstanceCount),
                    new Column("Topology", dc => dc.PrimitiveTopology?.Topology),
                });
            }

            IEnumerable <IColumns> GetShaderColumns((ShaderType shaderType, ShaderColumns columns) _)
            {
                var  shaderType = _.shaderType;
                var  subColumns = _.columns;
                char x          = shaderType.ToString().ToLower()[0];

                yield return(new ShaderColumn($"{x}s", dc => (dc.Shader(shaderType).SetShader?.Shader)));

                if (subColumns.HasFlag(ShaderColumns.CB))
                {
                    yield return(new AssetColumnSet($"{x}s-cb", dc => dc.Shader(shaderType).SetConstantBuffers, SetConstantBuffers.UsedSlots.GetOrAdd(shaderType)));
                }
                if (subColumns.HasFlag(ShaderColumns.T))
                {
                    yield return(new AssetColumnSet($"{x}s-t", dc => dc.Shader(shaderType).SetShaderResources, SetShaderResources.UsedSlots.GetOrAdd(shaderType)));
                }
            }

            columns.AddRange(shaderColumns.OrderBy(s => s.type).SelectMany(GetShaderColumns));

            if (columnGroups.HasFlag(DrawCallColumns.RT))
            {
                columns.Add(new AssetColumnSet("o", dc => dc.SetRenderTargets, OMSetRenderTargets.UsedSlots));
            }

            if (columnGroups.HasFlag(DrawCallColumns.D))
            {
                columns.Add(new HashColumn("oD", dc => dc.SetRenderTargets?.DepthStencil?.Asset));
            }

            if (columnGroups.HasFlag(DrawCallColumns.Logic))
            {
                columns.Add(new Column("Pre,Post", dc => $"\"{logicSplit.Replace(dc.Logic ?? "", "\",\"")}\""));
            }

            output.WriteLine($"{columns.Headers()}");
            frames.ForEach(frame => frame.DrawCalls.ForEach(drawCall => output.WriteLine($"{columns.Values(drawCall)}")));
        }
コード例 #4
0
 static Program()
 {
     ui         = new ConsoleInterface();
     loadedData = new MigotoData(ui);
 }