metal: use a fallback for fonts when luminance-alpha isn't supported.

This commit is contained in:
Alex Szpakowski
2022-01-22 14:41:42 -04:00
parent 62de8f62c7
commit 1cf0073cf4
6 changed files with 79 additions and 36 deletions
+8 -8
View File
@@ -61,17 +61,17 @@ Texture::Texture(love::graphics::Graphics *gfxbase, id<MTLDevice> device, const
desc.arrayLength = layers;
desc.mipmapLevelCount = mipmapCount;
desc.textureType = getMTLTextureType(texType, 1);
if (@available(macOS 10.15, iOS 13, *))
auto formatdesc = Metal::convertPixelFormat(device, format, sRGB);
desc.pixelFormat = formatdesc.format;
if (formatdesc.swizzled)
{
// We already don't really support metal on older systems, this just
// silences a compiler warning about it.
auto formatdesc = Metal::convertPixelFormat(device, format, sRGB);
desc.pixelFormat = formatdesc.format;
if (formatdesc.swizzled)
// Swizzled formats are already only used on supported systems, this
// just silences a compiler warning about it.
if (@available(macOS 10.15, iOS 13, *))
desc.swizzle = formatdesc.swizzle;
}
else
throw love::Exception("Metal backend is only supported on macOS 10.15+ and iOS 13+.");
desc.storageMode = MTLStorageModePrivate;
if (readable)