Пример #1
0
        // If OutputWriter is left as null; output will be written to Console.
        // Otherwise output is directed to the passed HandleOutputWrite object (defined by the calling application, for example GUI element or file)
        public PrintZFrameSummary(ShaderFile shaderFile, ZFrameFile zframeFile,
                                  HandleOutputWrite outputWriter = null, bool showRichTextBoxLinks = false)
        {
            this.shaderFile   = shaderFile;
            this.zframeFile   = zframeFile;
            this.OutputWriter = outputWriter ?? ((x) => { Console.Write(x); });

            if (zframeFile.vcsProgramType == VcsProgramType.Features)
            {
                OutputWriteLine("Zframe byte data (encoding for features files has not been determined)");
                zframeFile.datareader.BaseStream.Position = 0;
                string zframeBytes = zframeFile.datareader.ReadBytesAsString((int)zframeFile.datareader.BaseStream.Length);
                OutputWriteLine(zframeBytes);
                return;
            }

            this.showRichTextBoxLinks = showRichTextBoxLinks;
            if (showRichTextBoxLinks)
            {
                OutputWriteLine($"View byte detail \\\\{Path.GetFileName(shaderFile.filenamepath)}-ZFRAME{zframeFile.zframeId:x08}-databytes");
                OutputWriteLine("");
            }
            PrintConfigurationState();
            PrintFrameLeadingArgs();
            SortedDictionary <int, int> writeSequences = GetWriteSequences();

            PrintWriteSequences(writeSequences);
            PrintDataBlocks(writeSequences);

            if (zframeFile.vcsProgramType == VcsProgramType.VertexShader)
            {
                OutputWriteLine($"// configuration states ({zframeFile.leadingSummary.Length}), leading summary\n");
                OutputWriteLine(SummarizeBytes(zframeFile.leadingSummary) + "\n");
            }
            OutputWriteLine($"// configuration states ({zframeFile.trailingSummary.Length}), trailing summary\n");
            OutputWriteLine(SummarizeBytes(zframeFile.trailingSummary) + "\n");
            OutputWrite("\n");

            PrintSourceSummary();
            PrintEndBlocks();
        }
Пример #2
0
        static Dictionary <int, GpuSource> GetBlockIdToSource(ZFrameFile zframeFile)
        {
            Dictionary <int, GpuSource> blockIdToSource = new();

            if (zframeFile.vcsProgramType == VcsProgramType.VertexShader || zframeFile.vcsProgramType == VcsProgramType.GeometryShader ||
                zframeFile.vcsProgramType == VcsProgramType.ComputeShader || zframeFile.vcsProgramType == VcsProgramType.DomainShader ||
                zframeFile.vcsProgramType == VcsProgramType.HullShader)
            {
                foreach (VsEndBlock vsEndBlock in zframeFile.vsEndBlocks)
                {
                    blockIdToSource.Add(vsEndBlock.blockIdRef, zframeFile.gpuSources[vsEndBlock.sourceRef]);
                }
            }
            else
            {
                foreach (PsEndBlock psEndBlock in zframeFile.psEndBlocks)
                {
                    blockIdToSource.Add(psEndBlock.blockIdRef, zframeFile.gpuSources[psEndBlock.sourceRef]);
                }
            }
            return(blockIdToSource);
        }