Jump to content

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.

PC:

AMD Ryzen 9 5900X | AMD Radeon RX 7900 GRE | 32 GB RAM | Arch Linux

Laptop:

MacBook Pro 13" (2019) | Intel Core i5 8279U | 8 GB RAM | macOS

Server:

Intel Core i7 6700K | 16 GB RAM | 2 TB HDD | Debian Linux

Link to comment
https://linustechtips.com/topic/1169098-request-gpu-in-swift-app/
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

×