mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Don't raise AlreadyDestroyed error on repeated destroy() calls (#7686)
* Don't raise `AlreadyDestroyed` error on repeated `destroy()` calls * Add changelog entry
This commit is contained in:
parent
f04391d916
commit
0dc6bfdd67
@ -80,6 +80,7 @@ Naga now infers the correct binding layout when a resource appears only in an as
|
|||||||
#### General
|
#### General
|
||||||
|
|
||||||
- Removed `MaintainBase` in favor of using `PollType`. By @waywardmonkeys in [#7508](https://github.com/gfx-rs/wgpu/pull/7508).
|
- Removed `MaintainBase` in favor of using `PollType`. By @waywardmonkeys in [#7508](https://github.com/gfx-rs/wgpu/pull/7508).
|
||||||
|
- wgpu-core no longer raises an error if `destroy` is called multiple times for a buffer or texture. This only affects the wgpu-core API; the wgpu API already allowed multiple `destroy` calls. By @andyleiserson in [#7686](https://github.com/gfx-rs/wgpu/pull/7686).
|
||||||
|
|
||||||
#### Naga
|
#### Naga
|
||||||
|
|
||||||
|
|||||||
@ -713,7 +713,8 @@ impl Buffer {
|
|||||||
let raw = match self.raw.snatch(&mut snatch_guard) {
|
let raw = match self.raw.snatch(&mut snatch_guard) {
|
||||||
Some(raw) => raw,
|
Some(raw) => raw,
|
||||||
None => {
|
None => {
|
||||||
return Err(DestroyError::AlreadyDestroyed);
|
// Per spec, it is valid to call `destroy` multiple times.
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1189,7 +1190,8 @@ impl Texture {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
return Err(DestroyError::AlreadyDestroyed);
|
// Per spec, it is valid to call `destroy` multiple times.
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1953,8 +1955,6 @@ impl QuerySet {
|
|||||||
#[derive(Clone, Debug, Error)]
|
#[derive(Clone, Debug, Error)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum DestroyError {
|
pub enum DestroyError {
|
||||||
#[error("Resource is already destroyed")]
|
|
||||||
AlreadyDestroyed,
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
InvalidResource(#[from] InvalidResourceError),
|
InvalidResource(#[from] InvalidResourceError),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user