public (int VertexOffset, int VertexCount) AddVertices(ReadOnlySpan <Byte> vertexData, VertexDeclaration vertexFormat) { var count = vertexData.Length / vertexFormat.VertexStride; if (count == 0) { return(_VertexCount, 0); } if (_VertexCount == 0) { _VertexElements = vertexFormat.GetVertexElements(); _VertexStride = vertexFormat.VertexStride; } else { var thisVD = new VertexDeclaration(_VertexStride, _VertexElements); if (!thisVD.Equals(vertexFormat)) { throw new ArgumentException(nameof(vertexFormat)); } } vertexData = vertexData.Slice(0, count * _VertexStride); int offset = _VertexCount; Array.Resize(ref _VertexData, (offset + count) * _VertexStride); vertexData.CopyTo(_VertexData.AsSpan().Slice(offset * _VertexStride)); _VertexCount += count; return(offset, count); }