Web
Analytics
Log In  

0

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)

sdl macos
P#42764 2017-07-24 21:27 ( Edited 2017-07-31 12: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

::

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

::

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

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2018-05-21 20:42 | 0.206s | 1572k | Q:13