Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow opting out of the dedicated GPU on macOS #1095

Closed
terhechte opened this issue Jan 11, 2022 · 4 comments · Fixed by #1681
Closed

Allow opting out of the dedicated GPU on macOS #1095

terhechte opened this issue Jan 11, 2022 · 4 comments · Fixed by #1681
Labels
egui_glow Relates to running egui_glow on native feature New feature or request performance Lower CPU/GPU usage (optimize)

Comments

@terhechte
Copy link
Contributor

Is your feature request related to a problem? Please describe.

There's an issue on Postsack about high battery consumption of the app when run on MacBook Pros that contain a dedicated GPU. Basically by default any egui app switches macOS to the more powerful dedicated GPU. In most cases, though, the internal GPU (of the Intel chipset) would be enough for rendering the app.

Glium supports this via the with_hardware_acceleration call. However, egui_glium currently doesn't expose this.

Describe the solution you'd like

My proposal would be to add an additional requires_dedicated_gpu field to epi::NativeOptions and then use that in the epi_backend. The default value could be true but it would be nice to be able to opt out. The whole thing could also be limited to macOS via target_os = "macos". I'd be willing to implement this in a PR if this solution is approved.

Describe alternatives you've considered

Not implementing it would make any egui app on most of the older MacBook Pros out there consume their battery faster (also, heat up and turn on the fans I guess).

Additional context

rust-windowing/glutin#980

@emilk
Copy link
Owner

emilk commented Jan 17, 2022

The new default native backend for eframe is glow, so we need to look at how that could be accomplished there.

@emilk emilk added egui_glow Relates to running egui_glow on native performance Lower CPU/GPU usage (optimize) labels Jan 17, 2022
@hacknus
Copy link
Contributor

hacknus commented May 15, 2022

is there an update to this? I am also interested in a solution for that, but I have no idea where the problematic line is in the glow backend...

@coderedart
Copy link
Contributor

coderedart commented May 16, 2022

it seems glow has nothing to do with this. this seems to be a opengl context creation / loading thing. glow just wraps around the already loaded functions with more rusty types.

glium uses glutin. egui also uses glutin https://github.com/emilk/egui/blob/master/eframe/src/native/run.rs#L19 .
just need to add the option and pass it to the glutin builder ^^ and this should work.

only someone with a mac can send a PR and verify that it works :)

@terhechte
Copy link
Contributor Author

Thanks @coderedart I hadn't seen this earlier, I've created a PR to add the functionality to run.rs :)

#1681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_glow Relates to running egui_glow on native feature New feature or request performance Lower CPU/GPU usage (optimize)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants