Add flag to disable hardware acceleration (#1681)

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.
This commit is contained in:
Benedikt Terhechte
2022-05-28 17:53:05 +02:00
committed by GitHub
parent 1d9524cc59
commit 72e38370fe
4 changed files with 14 additions and 5 deletions
+6 -5
View File
@@ -47,11 +47,12 @@ pub fn window_builder(
max_window_size,
resizable,
transparent,
vsync: _, // used in `fn create_display`
multisampling: _, // used in `fn create_display`
depth_buffer: _, // used in `fn create_display`
stencil_buffer: _, // used in `fn create_display`
renderer: _, // used in `fn run_native`
vsync: _, // used in `fn create_display`
multisampling: _, // used in `fn create_display`
depth_buffer: _, // used in `fn create_display`
stencil_buffer: _, // used in `fn create_display`
hardware_acceleration: _, // used in `fn create_display`
renderer: _, // used in `fn run_native`
} = native_options;
let window_icon = icon_data.clone().and_then(load_icon);
+1
View File
@@ -17,6 +17,7 @@ fn create_display(
crate::profile_function!();
let gl_window = unsafe {
glutin::ContextBuilder::new()
.with_hardware_acceleration(native_options.hardware_acceleration)
.with_depth_buffer(native_options.depth_buffer)
.with_multisampling(native_options.multisampling)
.with_srgb(true)