Esempio n. 1
0
        public static DebugAnnotation Parse(DebugBytecodeReader reader, DebugBytecodeReader annotationReader)
        {
            var result = new DebugAnnotation();

            result.ParameterOffset = annotationReader.ReadUInt32("ParameterOffset");
            result.ValueOffset     = annotationReader.ReadUInt32("ValueOffset");

            var parameterReader = reader.CopyAtOffset("AnnotationType", annotationReader, (int)result.ParameterOffset);

            result.Parameter = DebugParameter.Parse(reader, parameterReader);

            var valueReader = reader.CopyAtOffset("ValueReader", annotationReader, (int)result.ValueOffset);

            result.Values = result.Parameter.ReadParameterValue(valueReader);

            return(result);
        }
Esempio n. 2
0
        public static DebugVariable Parse(DebugBytecodeReader reader, DebugBytecodeReader variableReader)
        {
            var result = new DebugVariable();

            result.ParameterOffset    = variableReader.ReadUInt32("ParameterOffset");
            result.DefaultValueOffset = variableReader.ReadUInt32("DefaultValueOffset");
            result.IsShared           = variableReader.ReadUInt32("IsShared");
            result.AnnotationCount    = variableReader.ReadUInt32("AnnotationCount");
            for (int i = 0; i < result.AnnotationCount; i++)
            {
                variableReader.AddIndent($"Annotation {i}");
                result.Annotations.Add(DebugAnnotation.Parse(reader, variableReader));
                variableReader.RemoveIndent();
            }
            var paramterReader = reader.CopyAtOffset("ParameterReader", variableReader, (int)result.ParameterOffset);

            result.Parameter = DebugParameter.Parse(reader, paramterReader);

            if (result.Parameter.ParameterType.IsSampler())
            {
                var elementCount       = result.Parameter.Elements > 0 ? result.Parameter.Elements : 1;
                var samplerStateReader = reader.CopyAtOffset("SamplerStateReader", variableReader, (int)result.DefaultValueOffset);
                for (int i = 0; i < elementCount; i++)
                {
                    samplerStateReader.AddIndent($"SamplerState {i}");
                    result.SamplerStates.Add(DebugSamplerState.Parse(reader, samplerStateReader));
                    samplerStateReader.RemoveIndent();
                }
            }
            else
            {
                var valueReader = reader.CopyAtOffset("ValueReader", variableReader, (int)result.DefaultValueOffset);
                result.Value = result.Parameter.ReadParameterValue(valueReader);
            }
            return(result);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }