Skip to content

Instantly share code, notes, and snippets.

@legumbre
Last active October 21, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legumbre/5b707d4d08d9f68d17a0bc45a7cfaa05 to your computer and use it in GitHub Desktop.
Save legumbre/5b707d4d08d9f68d17a0bc45a7cfaa05 to your computer and use it in GitHub Desktop.
Using the Integrated GPU with Metal

Using Integrated GPU with Metal

The following steps were required to get a Metal-based renderer on macos Mojave (10.4.6) to use the Intel (Integrated) GPU instead of the AMD discrete one (High Perf GPU).

  1. Do not use MTLCreateDefaultDevice. Instead, use MTLCopyAllDevices to get a list of all available GPUs and then keep the one satisfying device.lowPower == true

  2. Set "Supports Automatic Graphics Switching" (NSSupportsAutomaticGraphicsSwitching)key in the App's Info.plist to YES

Launch Activity Monitor and verify the App is now listed with "Requires High-Perf GPU: NO".

Gotchas

Make sure there aren't any stray MTLCreateDefaultDevice() calls in your code. A single MTLCreateDefaultDevice call, even with its return value discarded, will cause the App to use the discrete GPU instead of the integrated one. This holds true even if you followed all of the steps above.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment