Log In  
Log In  

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)

P#42764 2017-07-24 21:27 ( Edited 2017-07-31 16:51)

Sorry, this is not too helpful, but you are able to edit your post. You don't need to comment to add more information.

P#42816 2017-07-26 20:04 ( Edited 2017-07-27 00:04)
:: zep

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:

  1. Open Terminal and navigate to PICO-8.app/Contents/MacOS

  2. 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)

P#42838 2017-07-28 05:44 ( Edited 2017-07-28 09:44)

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;
P#42957 2017-07-31 12:51 ( Edited 2017-07-31 16:51)

Is this something that might get changed for future releases?

P#59905 2018-12-11 20:40

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-01-21 17:34 | 0.026s | 2097k | Q:20