-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add flag to disable hardware acceleration #1681
Conversation
/// Use hardware acceleration if available. On macOS, this will possibly | ||
/// use a dedicated GPU which will lead to higher power consumption. | ||
/// The default value is `Some(true)` | ||
pub hardware_acceleration: Option<bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what None
means? It is not documented at https://docs.rs/glutin/latest/glutin/struct.ContextBuilder.html#method.with_hardware_acceleration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on mac, glutin only sets the relevant attribute (mentioned below) if it is some, otherwise it just skips setting that attribute.
A Boolean attribute. If present, this attribute indicates that only hardware-accelerated renderers are considered. If not present, accelerated renderers are still preferred.
so, hw acceleration preferred by default (None). if Some(true)
, only hw acceleration contexts are considered. but ofcourse, someone with mac needs to test it out just to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - so the current default (before and after this PR) means that we ONLY consider hardware-accelerated renderers, which could explain #1358 (comment)
Perhaps the default should be None
to allow software rendered backends too.
Can this also be implemented in the glow (new standard) setup? In my setup, it does not change anything..
|
This PR was for |
that's weird, did I configure something wrong? because for me the flag for the dedicated GPU is still set.. |
I noticed that this does not disable the GPU flag on macOS 12.4, so the dedicated GPU is still enabled when the application is launched. But it causes the application to panic on Windows 10 (native and virtual): |
in the latest egui version (0.21.0) I get the following error under windows, when I set
I get the following error:
but when I leave out the |
Closes #1095
This is a fix for the behaviour on macOS platforms where any egui app would use the dedicated GPU and consume more power than needed. Not all apps might have dedicated GPU requirements.
The change here is to allow the user to opt in / out of hardware acceleration via the
glutin::ContextBuilder
with_hardware_acceleration method.The setting has been added to
NativeOptions
ans is used in theglutin
setup.Closes https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE.