예제 #1
0
        public static DebugPass Parse(DebugBytecodeReader reader, DebugBytecodeReader passReader)
        {
            var result = new DebugPass();

            result.NameOffset      = passReader.ReadUInt32("NameOffset");
            result.AnnotationCount = passReader.ReadUInt32("AnnoationCount");
            result.AssignmentCount = passReader.ReadUInt32("AssignmentCount");
            for (int i = 0; i < result.AnnotationCount; i++)
            {
                passReader.AddIndent($"Annotation {i}");
                result.Annotations.Add(DebugAnnotation.Parse(reader, passReader));
                passReader.RemoveIndent();
            }
            for (int i = 0; i < result.AssignmentCount; i++)
            {
                passReader.AddIndent($"Assignment {i}");
                result.Assignments.Add(DebugAssignment.Parse(reader, passReader));
                passReader.RemoveIndent();
            }
            var nameReader = reader.CopyAtOffset("NameReader", passReader, (int)result.NameOffset);

            result.Name = nameReader.TryReadString("Name");
            return(result);
        }
예제 #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);
        }