Skip to content

Commit

Permalink
Merge #864
Browse files Browse the repository at this point in the history
864: Remove `power` module r=kvark a=GabrielMajeri

**Connections**
Closes #859 

**Description**
Removes the `power.rs` module. If the user wants to detect the battery status and choose between low-power and high-performance, they can do so themselves.

**Testing**
Tested with core.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
  • Loading branch information
bors[bot] and GabrielMajeri authored Aug 5, 2020
2 parents 78546f4 + 021251a commit fc14f3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 80 deletions.
17 changes: 4 additions & 13 deletions wgpu-core/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
device::Device,
hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Input, Token},
id::{AdapterId, DeviceId, SurfaceId, Valid},
power, span, LifeGuard, PrivateFeatures, Stored, MAX_BIND_GROUPS,
span, LifeGuard, PrivateFeatures, Stored, MAX_BIND_GROUPS,
};

use wgt::{Backend, BackendBit, DeviceDescriptor, PowerPreference, BIND_BUFFER_ALIGNMENT};
Expand Down Expand Up @@ -500,18 +500,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}

let preferred_gpu = match desc.power_preference {
PowerPreference::Default => match power::is_battery_discharging() {
Ok(false) => discrete.or(integrated).or(other).or(virt),
Ok(true) => integrated.or(discrete).or(other).or(virt),
Err(err) => {
tracing::debug!(
"Power info unavailable, preferring integrated gpu ({})",
err
);
integrated.or(discrete).or(other).or(virt)
}
},
PowerPreference::LowPower => integrated.or(other).or(discrete).or(virt),
PowerPreference::Default | PowerPreference::LowPower => {
integrated.or(other).or(discrete).or(virt)
}
PowerPreference::HighPerformance => discrete.or(other).or(integrated).or(virt),
};

Expand Down
1 change: 0 additions & 1 deletion wgpu-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub mod id;
pub mod instance;
pub mod logging;
pub mod pipeline;
pub mod power;
pub mod resource;
pub mod swap_chain;
mod track;
Expand Down
66 changes: 0 additions & 66 deletions wgpu-core/src/power.rs

This file was deleted.

0 comments on commit fc14f3d

Please sign in to comment.