mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[types] Replace conditional derive(thiserror::Error) with unconditional impl. (#8384)
This commit is contained in:
parent
4ea04a69c9
commit
f366e9615f
@ -88,6 +88,7 @@ SamplerDescriptor {
|
||||
- WebGPU device requests now support the required limits `maxColorAttachments` and `maxColorAttachmentBytesPerSample`. By @evilpie in [#8328](https://github.com/gfx-rs/wgpu/pull/8328)
|
||||
- Reject binding indices that exceed `wgpu_types::Limits::max_bindings_per_bind_group` when deriving a bind group layout for a pipeline. By @jimblandy in [#8325](https://github.com/gfx-rs/wgpu/pull/8325).
|
||||
- Removed three features from `wgpu-hal` which did nothing useful: `"cargo-clippy"`, `"gpu-allocator"`, and `"rustc-hash"`. By @kpreid in [#8357](https://github.com/gfx-rs/wgpu/pull/8357).
|
||||
- `wgpu_types::PollError` now always implements the `Error` trait. By @kpreid in [#8384](https://github.com/gfx-rs/wgpu/pull/8384).
|
||||
|
||||
#### DX12
|
||||
|
||||
|
||||
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5053,7 +5053,6 @@ dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.17",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ alloc_instead_of_core = "warn"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["js-sys?/std", "web-sys?/std", "thiserror/std"]
|
||||
std = ["js-sys?/std", "web-sys?/std"]
|
||||
strict_asserts = []
|
||||
fragile-send-sync-non-atomic-wasm = []
|
||||
serde = ["dep:serde", "bitflags/serde"]
|
||||
@ -52,7 +52,6 @@ web = ["dep:js-sys", "dep:web-sys"]
|
||||
bitflags.workspace = true
|
||||
bytemuck = { workspace = true, features = ["derive"] }
|
||||
log.workspace = true
|
||||
thiserror = { workspace = true, optional = true }
|
||||
serde = { workspace = true, default-features = false, features = [
|
||||
"alloc",
|
||||
"derive",
|
||||
|
||||
@ -4564,24 +4564,35 @@ impl<T> PollType<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Error states after a device poll
|
||||
/// Error states after a device poll.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "std", derive(thiserror::Error))]
|
||||
pub enum PollError {
|
||||
/// The requested Wait timed out before the submission was completed.
|
||||
#[cfg_attr(
|
||||
feature = "std",
|
||||
error("The requested Wait timed out before the submission was completed.")
|
||||
)]
|
||||
Timeout,
|
||||
/// The requested Wait was given a wrong submission index.
|
||||
#[cfg_attr(
|
||||
feature = "std",
|
||||
error("Tried to wait using a submission index ({0}) that has not been returned by a successful submission (last successful submission: {1})")
|
||||
)]
|
||||
WrongSubmissionIndex(u64, u64),
|
||||
}
|
||||
|
||||
// This impl could be derived by `thiserror`, but by not doing so, we can reduce the number of
|
||||
// dependencies this early in the dependency graph, which may improve build parallelism.
|
||||
impl fmt::Display for PollError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
PollError::Timeout => {
|
||||
f.write_str("The requested Wait timed out before the submission was completed.")
|
||||
}
|
||||
PollError::WrongSubmissionIndex(requested, successful) => write!(
|
||||
f,
|
||||
"Tried to wait using a submission index ({requested}) \
|
||||
that has not been returned by a successful submission \
|
||||
(last successful submission: {successful}"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl core::error::Error for PollError {}
|
||||
|
||||
/// Status of device poll operation.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum PollStatus {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user