#[non_exhaustive]pub struct GpuConfig {
pub label: &'static str,
pub copy_src: CopySrc,
pub present_mode: PresentMode,
pub optional_features: Features,
pub surface_retry_budget: Duration,
}Expand description
Everything Gpu::new needs beyond the window handle.
Build one with GpuConfig::new (or Default) and the with_*
setters rather than a struct literal — the struct is #[non_exhaustive]
so new knobs can be added without a breaking release:
use agg_gui_wgpu::{CopySrc, GpuConfig};
let cfg = GpuConfig::new("my-app").with_copy_src(CopySrc::IfSupported);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.label: &'static strwgpu::DeviceDescriptor label — shows up in backend validation
messages and GPU captures, so each shell names its own.
copy_src: CopySrcSurface read-back requirement, see CopySrc.
present_mode: PresentModePresent mode for the swap chain. AutoVsync for normal windows.
optional_features: FeaturesDevice features requested when the adapter offers them — the set is
masked against adapter.features() before request_device, so an
adapter that lacks one still yields a device (the app degrades instead
of failing to start). For an app renderer that can use, e.g.,
FLOAT32_BLENDABLE when present and fall back when not.
surface_retry_budget: DurationHow long the swap chain may stay continuously unconfigured — every
Surface::configure retry failing — before Gpu::try_acquire_frame
gives up with SurfaceError. Default 10 s. See
GpuConfig::with_surface_retry_budget.
Measured from the first failure of the run and judged when a retry fails. Giving up also needs a minimum number of failed attempts (12, about 6.5 s of continuous retrying), so a caller that paused attempts past the budget — agg-gui-shell does while its window is minimized mid-run — still gets a real retry run afterwards rather than an error at its first failed retry.
Implementations§
Source§impl GpuConfig
impl GpuConfig
Sourcepub fn new(label: &'static str) -> Self
pub fn new(label: &'static str) -> Self
Default configuration under a shell-specific device label.
pub fn with_copy_src(self, copy_src: CopySrc) -> Self
Sourcepub fn with_present_mode(self, present_mode: PresentMode) -> Self
pub fn with_present_mode(self, present_mode: PresentMode) -> Self
Override the swap-chain present mode (default AutoVsync).
Sourcepub fn with_optional_features(self, features: Features) -> Self
pub fn with_optional_features(self, features: Features) -> Self
Request these device features when — and only when — the adapter
offers them. See GpuConfig::optional_features.
Sourcepub fn with_surface_retry_budget(self, budget: Duration) -> Self
pub fn with_surface_retry_budget(self, budget: Duration) -> Self
Override how long a failing swap chain is retried before
Gpu::try_acquire_frame reports SurfaceError (default 10 s).
A minimum number of failed attempts is also required, so a very short
budget still gets roughly 6.5 s of actual retrying. Duration::MAX
retries forever. See GpuConfig::surface_retry_budget.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuConfig
impl RefUnwindSafe for GpuConfig
impl Send for GpuConfig
impl Sync for GpuConfig
impl Unpin for GpuConfig
impl UnsafeUnpin for GpuConfig
impl UnwindSafe for GpuConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().