public static HwDataBuffer FromData(BinaryReader reader, GameType gameType) { var x = new HwDataBuffer(); uint bufferElementCount = reader.ReadUInt32(); if (bufferElementCount > 0) { uint isStreaming = reader.ReadUInt32(); x.Flags = reader.ReadUInt32(); var format = (BaseDataBufferFormat)reader.ReadUInt32(); uint bufferStride = reader.ReadUInt32(); if (isStreaming != 0 && isStreaming != 1) { throw new InvalidDataException("Must be true or false"); } if (format != BaseDataBufferFormat.Structured) { bufferStride = HwBuffer.GetStrideForFormat(format); } x.Buffer = HwBuffer.FromData(reader, gameType, format, isStreaming != 0, bufferStride, bufferElementCount); } return(x); }
public static HwDataBuffer FromData(BinaryReader reader, GameType gameType) { var buffer = new HwDataBuffer(); uint bufferElementCount = reader.ReadUInt32(); if (bufferElementCount > 0) { var streamingMode = (BaseRenderDataStreamingMode)reader.ReadUInt32(); buffer.Flags = reader.ReadUInt32(); var format = (BaseDataBufferFormat)reader.ReadUInt32(); uint bufferStride = reader.ReadUInt32(); if (format != BaseDataBufferFormat.Structured) { bufferStride = HwBuffer.GetStrideForFormat(format); } buffer.Buffer = HwBuffer.FromData(reader, gameType, format, streamingMode, bufferStride, bufferElementCount); } return(buffer); }