Skip to content

Commit

Permalink
metal: hook up t.graphics.lowpower.
Browse files Browse the repository at this point in the history
Resolves #2127.
  • Loading branch information
slime73 committed Dec 21, 2024
1 parent da365e2 commit 1c0491c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/modules/graphics/metal/Graphics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,21 @@ static inline void setSampler(id<MTLComputeCommandEncoder> encoder, Graphics::Re
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.");
}
Expand Down

0 comments on commit 1c0491c

Please sign in to comment.