public static LibraryParameterDescription Parse(BytecodeReader reader, BytecodeReader paramReader) { var nameOffset = paramReader.ReadUInt32(); var semanticNameOffset = paramReader.ReadUInt32(); var result = new LibraryParameterDescription() { VariableType = (ShaderVariableType)paramReader.ReadUInt32(), VariableClass = (ShaderVariableClass)paramReader.ReadUInt32(), Rows = paramReader.ReadUInt32(), Column = paramReader.ReadUInt32(), InterpolationMode = (InterpolationMode)paramReader.ReadUInt32(), Flags = (ParameterFlags)paramReader.ReadUInt32(), FirstInRegister = paramReader.ReadUInt32(), FirstInComponent = paramReader.ReadUInt32(), FirstOutRegister = paramReader.ReadUInt32(), FirstOutComponent = paramReader.ReadUInt32(), }; var nameReader = reader.CopyAtOffset((int)nameOffset); result.Name = nameReader.ReadString(); if (semanticNameOffset != 0) { var semanticNameReader = reader.CopyAtOffset((int)semanticNameOffset); result.SemanticName = semanticNameReader.ReadString(); } else { result.SemanticName = ""; } return(result); }
public static LibraryParameterSignatureChunk Parse(BytecodeReader reader, uint chunkSize) { var result = new LibraryParameterSignatureChunk(); var chunkReader = reader.CopyAtCurrentPosition(); var parameterCount = chunkReader.ReadUInt32(); var paramterOffset = chunkReader.ReadUInt32(); for (int i = 0; i < parameterCount; i++) { var parameterReader = chunkReader.CopyAtOffset((int)paramterOffset + 12 * 4 * i); result.Parameters.Add(LibraryParameterDescription.Parse(reader, parameterReader)); } return(result); }