diff --git a/src/Graphics/Font/Font.cs b/src/Graphics/Font/Font.cs index 1c0c9a6..e15970a 100644 --- a/src/Graphics/Font/Font.cs +++ b/src/Graphics/Font/Font.cs @@ -49,25 +49,12 @@ namespace MoonWorks.Graphics.Font var imagePath = Path.ChangeExtension(fontPath, ".png"); ImageUtils.ImageInfoFromFile(imagePath, out var width, out var height, out var sizeInBytes); - var texture = Texture.CreateTexture2D(graphicsDevice, width, height, TextureFormat.R8G8B8A8, TextureUsageFlags.Sampler); - var transferBuffer = new TransferBuffer(graphicsDevice, sizeInBytes); - ImageUtils.DecodeIntoTransferBuffer( - imagePath, - transferBuffer, - 0, - TransferOptions.Overwrite - ); + var uploader = new ResourceUploader(graphicsDevice); + var texture = uploader.CreateTexture2DFromCompressed(imagePath); + uploader.Upload(); + uploader.Dispose(); - commandBuffer.BeginCopyPass(); - commandBuffer.UploadToTexture( - transferBuffer, - texture, - WriteOptions.SafeOverwrite - ); - commandBuffer.EndCopyPass(); - - transferBuffer.Dispose(); NativeMemory.Free(fontFileByteBuffer); NativeMemory.Free(atlasFileByteBuffer);