Esempio n. 1
0
        public static DebugEffectTechnique Parse(DebugBytecodeReader reader,
                                                 DebugBytecodeReader techniqueReader, DebugShaderVersion version)
        {
            var result     = new DebugEffectTechnique(version);
            var nameOffset = result.NameOffset = techniqueReader.ReadUInt32("NameOffset");
            var nameReader = reader.CopyAtOffset("NameReader", techniqueReader, (int)nameOffset);

            result.Name            = nameReader.ReadString("Name");
            result.PassCount       = techniqueReader.ReadUInt32("PassCount");
            result.AnnotationCount = techniqueReader.ReadUInt32("AnnotationCount");

            for (int i = 0; i < result.AnnotationCount; i++)
            {
                techniqueReader.AddIndent("Annotation");
                result.Annotations.Add(DebugEffectAnnotation.Parse(reader, techniqueReader, version));
                techniqueReader.RemoveIndent();
            }
            for (int i = 0; i < result.PassCount; i++)
            {
                techniqueReader.AddIndent($"Pass {i}");
                result.Passes.Add(DebugEffectPass.Parse(reader, techniqueReader, version));
                techniqueReader.RemoveIndent();
            }
            return(result);
        }
        public static DebugEffectPass Parse(DebugBytecodeReader reader, DebugBytecodeReader passReader, DebugShaderVersion version)
        {
            var result     = new DebugEffectPass();
            var nameOffset = result.NameOffset = passReader.ReadUInt32("NameOffset");
            var nameReader = reader.CopyAtOffset("NameReader", passReader, (int)nameOffset);

            result.Name            = nameReader.ReadString("Name");
            result.ShaderCount     = passReader.ReadUInt32("ShaderCount");
            result.AnnotationCount = passReader.ReadUInt32("AnnotationCount");
            for (int i = 0; i < result.AnnotationCount; i++)
            {
                passReader.AddIndent($"Annotation {i}");
                result.Annotations.Add(DebugEffectAnnotation.Parse(reader, passReader, version));
                passReader.RemoveIndent();
            }
            for (int i = 0; i < result.ShaderCount; i++)
            {
                passReader.AddIndent($"Shader {i}");
                result.Assignments.Add(DebugEffectAssignment.Parse(reader, passReader));
                passReader.RemoveIndent();
            }
            return(result);
        }