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.

THANK YOU!

Resources I found on this topic:

This is a link to how GLFW sets up an OpenGL context on the integrated GPU on macOS
https://github.com/glfw/glfw/blob/master/src/nsgl_context.m#L173

In SDL2, I added those two attributes used in the GLFW source to the NSOpenGLPixelFormat init call found in
"src/video/cocoa/SDL_cocoaopengl.m"

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"):
https://hg.libsdl.org/SDL/rev/fb4e35d0d523

(edited to a single post for easy reading, thanks @PixelBytes)

1


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


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)


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;

1

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.

thanks!


1

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?


I have the same problem on MacBook Pro 16. Has anyone found a solution?



[Please log in to post a comment]