PICO-8 uses the discrete GPU on mac laptops; this uses a lot of power on battery.
@zep, could PICO-8 use the integrated graphics instead of the discrete GPU?
I really hope this change is compatible with PICO-8, I would really like to use it on battery and still have decent battery life. PICO-8 seems lightweight otherwise.
Resources I found on this topic:
This is a link to how GLFW sets up an OpenGL context on the integrated GPU on macOS
In SDL2, I added those two attributes used in the GLFW source to the NSOpenGLPixelFormat init call found in
This caused all of the example apps in the Xcode "SDLTest" project in the SDL2 source code to use the integrated graphics, the attributes being: "NSOpenGLPFAAllowOfflineRenderers" and "kCGLPFASupportsAutomaticGraphicsSwitching"
Here is the partial change from the SDL source tree (missing adding attribute "kCGLPFASupportsAutomaticGraphicsSwitching"):
(edited to a single post for easy reading, thanks @PixelBytes)
Interesting -- yes, this looks like something PICO-8 probably should do as it only uses the gpu for blitting. I plan to do one more round of optimization during beta, but until then you could also try running in software blitting mode:
Open Terminal and navigate to PICO-8.app/Contents/MacOS
- Run PICO-8 with:
./pico8 -software_blit 1 -windowed 1
(this is still experimental for OSX and probably won't work in full-screen mode)
I ran PICO-8 with those command line arguments, but the discrete GPU was still used. :(
I've found that even trivial SDL apps that use just blitting will still trigger the discrete GPU on mac, unless those both "NSOpenGLPixelFormatAttribute" are provided.
In SDL2, these need to be added at about line 175 of src/video/cocoa/SDL_cocoaopengl.m
attr[i++] = NSOpenGLPFAAllowOfflineRenderers; attr[i++] = kCGLPFASupportsAutomaticGraphicsSwitching;
Success with the latest version v0.1.12c! It no longer uses the GPU by default.
I had to add NSSupportsAutomaticGraphicsSwitching TRUE to the info.plist. No need to pass "-software_blit 1 -windowed 1"
@zep could you add "NSSupportsAutomaticGraphicsSwitching TRUE" to the build?
Also, fyi it looks like the Pico-8 title bar is not Retina resolution.
Hi, my MacBook Pro 16" still switches to dedicated GPU when I launch Pico-8 v. 0.2.1b. NSSupportsAutomaticGraphicsSwitching was already set to TRUE in the info.plist in this version.
Am I doing something wrong, or are there anybody else who are experiencing the same behaviour?
[Please log in to post a comment]