metal: hook up t.graphics.lowpower.

Resolves #2127.
This commit is contained in:
Sasha Szpakowski
2024-12-20 21:06:27 -04:00
parent da365e2ab9
commit 1c0491c5c3
+15 -1
View File
@@ -289,7 +289,21 @@ Graphics::Graphics()
if (@available(macOS 10.15, iOS 13.0, *))
{
graphicsInstance = this;
device = MTLCreateSystemDefaultDevice();
#ifdef LOVE_MACOS
if (isLowPowerPreferred())
{
for (id<MTLDevice> dev in MTLCopyAllDevices())
{
if (dev.isLowPower)
{
device = dev;
break;
}
}
}
#endif
if (device == nil)
device = MTLCreateSystemDefaultDevice();
if (device == nil)
throw love::Exception("Metal is not supported on this system.");
}