public static Annotation Parse(BytecodeReader reader, BytecodeReader variableReader) { var result = new Annotation(); var parameterOffset = variableReader.ReadUInt32(); var valueOffset = variableReader.ReadUInt32(); var parameterReader = reader.CopyAtOffset((int)parameterOffset); result.Parameter = Parameter.Parse(reader, parameterReader); var valueReader = reader.CopyAtOffset((int)valueOffset); result.Value = result.Parameter.ReadParameterValue(valueReader); return(result); }
public static Assignment Parse(BytecodeReader reader, BytecodeReader shaderReader) { var result = new Assignment(); result.Type = (StateType)shaderReader.ReadUInt32(); result.ArrayIndex = shaderReader.ReadUInt32(); var parameterOffset = shaderReader.ReadUInt32(); var valueOffset = shaderReader.ReadUInt32(); var parameterReader = reader.CopyAtOffset((int)parameterOffset); result.Parameter = Parameter.Parse(reader, parameterReader); var valueReader = reader.CopyAtOffset((int)valueOffset); result.Value = result.Parameter.ReadParameterValue(valueReader); return(result); }
public static Parameter Parse(BytecodeReader reader, BytecodeReader variableReader) { var result = new Parameter(); result.ParameterType = (ParameterType)variableReader.ReadUInt32(); result.ParameterClass = (ParameterClass)variableReader.ReadUInt32(); var nameOffset = variableReader.ReadUInt32(); var semanticOffset = variableReader.ReadUInt32(); if (result.ParameterClass == ParameterClass.Scalar || result.ParameterClass == ParameterClass.Vector || result.ParameterClass == ParameterClass.MatrixRows || result.ParameterClass == ParameterClass.MatrixColumns) { result.ElementCount = variableReader.ReadUInt32(); result.Rows = variableReader.ReadUInt32(); result.Columns = variableReader.ReadUInt32(); } if (result.ParameterClass == ParameterClass.Struct) { result.ElementCount = variableReader.ReadUInt32(); result.StructMemberCount = variableReader.ReadUInt32(); for (int i = 0; i < result.StructMemberCount; i++) { result.StructMembers.Add(Parameter.Parse(reader, variableReader)); } } if (result.ParameterClass == ParameterClass.Object) { result.ElementCount = variableReader.ReadUInt32(); } var nameReader = reader.CopyAtOffset((int)nameOffset); result.Name = nameReader.TryReadString(); var semanticReader = reader.CopyAtOffset((int)semanticOffset); result.Semantic = semanticReader.TryReadString(); return(result); }