Document present_mode_from_env in iced_wgpu

This commit is contained in:
Héctor Ramón Jiménez 2024-05-07 21:13:51 +02:00
parent 8a0701a0d9
commit 5b6f3499e1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -52,6 +52,18 @@ impl From<graphics::Settings> for Settings {
}
}
/// Obtains a [`wgpu::PresentMode`] from the current environment
/// configuration, if set.
///
/// The value returned by this function can be changed by setting
/// the `ICED_PRESENT_MODE` env variable. The possible values are:
///
/// - `vsync` → [`wgpu::PresentMode::AutoVsync`]
/// - `no_vsync` → [`wgpu::PresentMode::AutoNoVsync`]
/// - `immediate` → [`wgpu::PresentMode::Immediate`]
/// - `fifo` → [`wgpu::PresentMode::Fifo`]
/// - `fifo_relaxed` → [`wgpu::PresentMode::FifoRelaxed`]
/// - `mailbox` → [`wgpu::PresentMode::Mailbox`]
pub fn present_mode_from_env() -> Option<wgpu::PresentMode> {
let present_mode = std::env::var("ICED_PRESENT_MODE").ok()?;