From cf1a5901fccafdaead225b0a5e55ff74fdcf9678 Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Wed, 17 Nov 2021 19:22:00 -0800 Subject: [PATCH] Mac: prefer integrated GPU --- macosx/mac-os.mm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/macosx/mac-os.mm b/macosx/mac-os.mm index 938a4b88..2c180f74 100644 --- a/macosx/mac-os.mm +++ b/macosx/mac-os.mm @@ -3119,6 +3119,23 @@ void QuitWithFatalError ( NSString *message) [s9xView addConstraint:[NSLayoutConstraint constraintWithItem:s9xView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:SNES_HEIGHT * 2.0]]; s9xView.device = MTLCreateSystemDefaultDevice(); S9xInitDisplay(NULL, NULL); + + id device = nil; + for ( id candidate in MTLCopyAllDevices() ) + { + if ( candidate.isLowPower ) + { + device = candidate; + break; + } + } + + if ( device == nil ) + { + device = MTLCreateSystemDefaultDevice(); + } + + s9xView.device = device; } - (void)start