metal: work around texture swizzle bug in the github runner VM

This commit is contained in:
Sasha Szpakowski
2024-04-26 20:32:15 -03:00
parent 5f97efd402
commit 0089749ad0
2 changed files with 12 additions and 2 deletions
+2
View File
@@ -251,6 +251,8 @@ private:
DeviceFamilies families;
bool isVMDevice;
}; // Graphics
} // metal
+10 -2
View File
@@ -283,6 +283,7 @@ Graphics::Graphics()
, uniformBufferGPUStart(0)
, defaultAttributesBuffer(nullptr)
, families()
, isVMDevice(false)
{ @autoreleasepool {
if (@available(macOS 10.15, iOS 13.0, *))
{
@@ -296,6 +297,8 @@ Graphics::Graphics()
throw love::Exception("LOVE's Metal graphics backend requires macOS 10.15+ or iOS 13+.");
}
isVMDevice = [device.name containsString:@("Apple Paravirtual device")];
#ifdef LOVE_MACOS
// On multi-GPU macOS systems with a low and high power GPU (e.g. a 2016
// Macbook Pro), the OS doesn't activate the high power GPU for final
@@ -1940,8 +1943,13 @@ bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage)
// Requires texture swizzle support.
if (@available(macOS 10.15, iOS 13, *))
{
if (families.apple[1] || families.mac[2] || families.macCatalyst[2])
flags |= commonsample;
// As of early 2024, the VM device doesn't properly support texture swizzles
// (observed on GitHub's runners) which is required for LA8 support.
if (!isVMDevice)
{
if (families.apple[1] || families.mac[2] || families.macCatalyst[2])
flags |= commonsample;
}
}
break;
case PIXELFORMAT_RG16_UNORM: