public static DebugEffectChunk Parse(DebugBytecodeReader reader, uint length)
        {
            var result       = new DebugEffectChunk();
            var footerOffset = reader.ReadUInt32("footerOffset");
            var bodyReader   = reader.CopyAtCurrentPosition("BodyReader", reader);
            var dummyReader  = bodyReader.CopyAtCurrentPosition("Dummy", bodyReader);

            dummyReader.ReadUInt32("Zero");
            var footerReader   = bodyReader.CopyAtOffset("FooterReader", reader, (int)footerOffset);
            var variableCount  = result.VariableCount = footerReader.ReadUInt32("VariableCount");
            var techniqueCount = result.TechniqueCount = footerReader.ReadUInt32("TechniqueCount");

            result.PassCount   = footerReader.ReadUInt32("PassCount");
            result.ShaderCount = footerReader.ReadUInt32("ShaderCount");

            for (int i = 0; i < variableCount; i++)
            {
                footerReader.AddIndent($"Variable {i}");
                result.Variables.Add(DebugVariable.Parse(bodyReader, footerReader));
                footerReader.RemoveIndent();
            }
            for (int i = 0; i < techniqueCount; i++)
            {
                footerReader.AddIndent($"Technique {i}");
                result.Techniques.Add(DebugTechnique.Parse(bodyReader, footerReader));
                footerReader.RemoveIndent();
            }

            result.VariableBlobCount = footerReader.ReadUInt32("VariableBlobCount");
            result.StateBlobCount    = footerReader.ReadUInt32("StateBlobCount");
            for (int i = 0; i < result.VariableBlobCount; i++)
            {
                footerReader.AddIndent($"VariableBlob {i}");
                result.VariableBlobs.Add(DebugBinaryData.Parse(bodyReader, footerReader));
                footerReader.RemoveIndent();
            }
            for (int i = 0; i < result.StateBlobCount; i++)
            {
                footerReader.AddIndent($"StateBlob {i}");
                result.StateBlobs.Add(DebugStateBlob.Parse(bodyReader, footerReader));
                footerReader.RemoveIndent();
            }
            return(result);
        }
Exemple #2
0
        public static DebugTechnique Parse(DebugBytecodeReader reader, DebugBytecodeReader techniqueReader)
        {
            var result = new DebugTechnique();

            result.NameOffset      = techniqueReader.ReadUInt32("NameOffset");
            result.AnnotationCount = techniqueReader.ReadUInt32("AnnotationCount");
            result.PassCount       = techniqueReader.ReadUInt32("PassCount");
            for (int i = 0; i < result.AnnotationCount; i++)
            {
                techniqueReader.AddIndent($"Annotation {i}");
                result.Annotations.Add(DebugAnnotation.Parse(reader, techniqueReader));
                techniqueReader.RemoveIndent();
            }
            for (int i = 0; i < result.PassCount; i++)
            {
                techniqueReader.AddIndent($"Pass {i}");
                result.Passes.Add(DebugPass.Parse(reader, techniqueReader));
                techniqueReader.RemoveIndent();
            }
            var nameReader = reader.CopyAtOffset("NameReader", techniqueReader, (int)result.NameOffset);

            result.Name = nameReader.TryReadString("Name");
            return(result);
        }