Jump to content

Request GPU in Swift app

Husky

I'm trying to develop a Swift menu bar app that switches between the iGPU and the dGPU of a MacBook Pro.

 

I've got the menu bar part right, but can't get the GPU switching working. I tried to have a look at some examples and compare code.

 

I tried to use:

let defaultDevice = MTLCreateSystemDefaultDevice()

but it doesn't seem to do anything.

 

All I want is for the dGPU to activate when I select the dGPU option in the menu, and for it to deactivate when I select the iGPU option. I understand that there is already an app to do this but it is quite old, forces the one GPU or the other (instead of simply requesting it), and I would prefer to do it myself in a leaner package.

 

Any help will be appreciated.

Workstation:

Intel Core i7 6700K | AMD Radeon R9 390X | 16 GB RAM

Mobile Workstation:

MacBook Pro 15" (2017) | Intel Core i7 7820HQ | AMD Radeon Pro 560 | 16 GB RAM

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×