private static byte[] GetDataSafe(this Buffer buffer, CommandList commandList = null) { var data = buffer.GetSerializationData(); if (data != null) { return(data.Content); } if (commandList == null) { throw new InvalidOperationException("Could not find underlying CPU buffer data and no command list was given to extract them from GPU"); } return(buffer.GetData <byte>(commandList)); }
private static byte[] GetDataSafe(this Buffer buffer) { var data = buffer.GetSerializationData(); return(data != null ? data.Content : buffer.GetData <byte>()); }