Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 18 variants DegenerateGrid { samples: [u32; 3], }, InvalidCellSize, InvalidOrigin, GridTooLarge { samples: [u32; 3], }, SampleCountMismatch { expected: u64, got: u64, }, NoAdapter, DeviceUnavailable, MapFailed, TimestampsUnsupported, FeaturesUnsupported { missing: Features, }, DeviceLost, ShaderModuleMissing { name: String, }, ShaderCircularInclude { name: String, }, ShaderDirective { module: String, line: usize, }, MeshShadersUnavailable, UnalignedReadback { bytes: u64, stride: u64, }, ScanTooLong { elements: u32, max: u32, }, DeferredQueueFull { capacity: usize, },
}
Expand description

Everything this crate can fail at.

One variant per genuinely distinct cause. There is deliberately no catch-all Other(String): a caller that cannot tell “no adapter” from “wrong buffer length” cannot react to either, and a variant that carries a message is a way of not deciding what the error is.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

DegenerateGrid

A grid axis had fewer than two samples, so it contains no cells.

Fields

§samples: [u32; 3]

The offending sample counts.

§

InvalidCellSize

The cell size was not a finite positive number.

§

InvalidOrigin

The grid origin was not finite.

§

GridTooLarge

The grid describes more samples than a u64 byte count can address.

Fields

§samples: [u32; 3]

The offending sample counts.

§

SampleCountMismatch

An upload’s slice length disagreed with the grid it is being written to.

Fields

§expected: u64

What the grid says it holds.

§got: u64

What the caller passed.

§

NoAdapter

No adapter matched the request. There is no software fallback here on purpose: a caller told “GPU extraction is running” while it is on a CPU reference driver has been misinformed about the only thing that matters.

§

DeviceUnavailable

The adapter refused to create a device with the requested limits.

§

MapFailed

Mapping a buffer for read-back failed.

§

TimestampsUnsupported

Timestamp queries were asked for and are not usable on this device.

Ticket: R-069 (P-71). Raised when the device was not created with wgpu::Features::TIMESTAMP_QUERY, when the queue reports a timestamp period of zero — a driver that advertises the feature and does not implement it — or when a resolved pair ends before it begins.

It refuses rather than degrading, on purpose. Falling back to Instant::now() under a GPU-side column name would report a number that was named and not measured, which is the failure the experiment harness’s missing-column panic exists to prevent, arriving by a different door.

§

FeaturesUnsupported

The adapter does not advertise a feature the caller asked for.

R-068. Gpu::open previously returned Self::TimestampsUnsupported for any missing feature, which was correct while timestamps were its only caller and became a lie the moment with_subgroups existed: a device without SUBGROUP would have reported that timestamps were unavailable. Carrying the missing set means the error names what is actually absent, and adding a third capability cannot reintroduce the bug.

Fields

§missing: Features

The features the adapter lacks.

§

DeviceLost

The device disconnected or a submission never completed.

§

ShaderModuleMissing

A shader module was included, or composed, but never registered.

Fields

§name: String

The name that was asked for.

§

ShaderCircularInclude

A shader module includes itself, through some chain.

Fields

§name: String

The module the cycle closes on.

§

ShaderDirective

A preprocessor directive was malformed or unbalanced.

Fields

§module: String

Module the directive is in.

§line: usize

One-based line number within that module.

§

MeshShadersUnavailable

The device cannot run mesh shaders.

Returned rather than substituting a vertex-buffer pipeline: a caller told “drawing” while a different pipeline ran has been misinformed about the one thing they asked for.

§

UnalignedReadback

A read-back range was not a whole number of elements.

Fields

§bytes: u64

Bytes asked for.

§stride: u64

Bytes per element.

§

ScanTooLong

A scan was asked for more elements than one dispatch can cover.

Level 0 dispatches one workgroup per PrefixScan::BLOCK elements, and max_compute_workgroups_per_dimension caps how many that can be.

Fields

§elements: u32

Elements the caller asked to scan.

§max: u32

The most this device will scan in one call.

§

DeferredQueueFull

crate::DeferredGeometry was asked to hold one more read-back than it has room for.

R-071 (P-71 C3). Its own variant rather than Self::DeviceLost or a silent drop, because it is the one error here that is not a failure: it is the queue telling a frame-budget scheduler that this frame’s submissions have caught up with last frame’s collections, which is the signal a caller uses to stop submitting. A dropped read-back would be a chunk of geometry that was extracted, paid for and never delivered, and nothing downstream could tell that from a chunk with no surface in it.

Fields

§capacity: usize

In-flight read-backs the queue was built to hold.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,