/// <summary>
        /// Saves this instance to a stream.
        /// </summary>
        /// <param name="stream">The destination stream.</param>
        public void Write(SerializationStream stream)
        {
            var enableStreaming = EnableStreaming && Image.Description.MipLevels > InitialNonStreamedMipCount;

            stream.Write(enableStreaming);
            if (enableStreaming)
            {
                // Write image header
                ImageHelper.ImageDescriptionSerializer.Serialize(ref Image.Description, ArchiveMode.Serialize, stream);

                // Write storage header
                Debug.Assert(!string.IsNullOrEmpty(StorageHeader.DataUrl));
                StorageHeader.Write(stream);

                // Note: in this scenario, we serialize only SkipStreamingMipCount (we know number is strictly higher than this due to previous check)
                var newDesc = Image.Description;
                newDesc.MipLevels = InitialNonStreamedMipCount;
                var pixelBuffers = new PixelBuffer[Image.Description.ArraySize * InitialNonStreamedMipCount];

                // Count number of mip maps that won't be part of initial load (they will be available through streaming)
                int skippedMipCount = Image.Description.MipLevels - InitialNonStreamedMipCount;
                for (uint item = 0; item < Image.Description.ArraySize; ++item)
                {
                    for (uint level = 0; level < InitialNonStreamedMipCount; ++level)
                    {
                        pixelBuffers[item * InitialNonStreamedMipCount + level] = Image.PixelBuffers[item * Image.Description.MipLevels + level + skippedMipCount];
                    }
                }

                // Adjust new Width/Height
                newDesc.Width  = pixelBuffers[0].Width;
                newDesc.Height = pixelBuffers[0].Height;

                var initialImage = new Image
                {
                    Description  = newDesc,
                    PixelBuffers = pixelBuffers,
                };
                // TODO: We end up duplicating some of the texture data; we could find a way to avoid that by saving only the chunks of higher level mips?
                initialImage.Save(stream.NativeStream, ImageFileType.Xenko);
            }
            else
            {
                // Write whole image (old texture content serialization)
                Image.Save(stream.NativeStream, ImageFileType.Xenko);
            }
        }
        /// <summary>
        /// Saves this instance to a stream.
        /// </summary>
        /// <param name="stream">The destination stream.</param>
        public void Write(SerializationStream stream)
        {
            stream.Write(EnableStreaming);
            if (EnableStreaming)
            {
                // Write image header
                ImageHelper.ImageDescriptionSerializer.Serialize(ref Image.Description, ArchiveMode.Serialize, stream);

                // Write storage header
                Debug.Assert(!string.IsNullOrEmpty(StorageHeader.DataUrl));
                StorageHeader.Write(stream);
            }
            else
            {
                // Write whole image (old texture content serialization)
                Image.Save(stream.NativeStream, ImageFileType.Xenko);
            }
        }