mirror of
https://github.com/storytold/wgpu.git
synced 2026-12-01 10:34:57 +01:00
[wgpu-core] use Fallible for Texture
This commit is contained in:
1 parent
68e8b7d4a8
commit
c630821f1d
8 files changed
+36
-76
No files matched your search
@@ -27,8 +27,6 @@ use wgt::{math::align_to, BufferAddress, BufferUsages, ImageSubresourceRange, Te
|
||||
pub enum ClearError {
|
||||
#[error("To use clear_texture the CLEAR_TEXTURE feature needs to be enabled")]
|
||||
MissingClearTextureFeature,
|
||||
#[error("TextureId {0:?} is invalid")]
|
||||
InvalidTextureId(TextureId),
|
||||
#[error(transparent)]
|
||||
DestroyedResource(#[from] DestroyedResourceError),
|
||||
#[error("{0} can not be cleared")]
|
||||
@@ -203,10 +201,7 @@ impl Global {
|
||||
return Err(ClearError::MissingClearTextureFeature);
|
||||
}
|
||||
|
||||
let dst_texture = hub
|
||||
.textures
|
||||
.get(dst)
|
||||
.map_err(|_| ClearError::InvalidTextureId(dst))?;
|
||||
let dst_texture = hub.textures.strict_get(dst).get()?;
|
||||
|
||||
dst_texture.same_device_as(cmd_buf.as_ref())?;
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ pub enum CopySide {
|
||||
#[derive(Clone, Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum TransferError {
|
||||
#[error("TextureId {0:?} is invalid")]
|
||||
InvalidTextureId(TextureId),
|
||||
#[error("Source and destination cannot be the same buffer")]
|
||||
SameSourceDestinationBuffer,
|
||||
#[error(transparent)]
|
||||
@@ -740,10 +738,7 @@ impl Global {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let dst_texture = hub
|
||||
.textures
|
||||
.get(destination.texture)
|
||||
.map_err(|_| TransferError::InvalidTextureId(destination.texture))?;
|
||||
let dst_texture = hub.textures.strict_get(destination.texture).get()?;
|
||||
|
||||
dst_texture.same_device_as(cmd_buf.as_ref())?;
|
||||
|
||||
@@ -904,10 +899,7 @@ impl Global {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let src_texture = hub
|
||||
.textures
|
||||
.get(source.texture)
|
||||
.map_err(|_| TransferError::InvalidTextureId(source.texture))?;
|
||||
let src_texture = hub.textures.strict_get(source.texture).get()?;
|
||||
|
||||
src_texture.same_device_as(cmd_buf.as_ref())?;
|
||||
|
||||
@@ -1082,14 +1074,8 @@ impl Global {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let src_texture = hub
|
||||
.textures
|
||||
.get(source.texture)
|
||||
.map_err(|_| TransferError::InvalidTextureId(source.texture))?;
|
||||
let dst_texture = hub
|
||||
.textures
|
||||
.get(destination.texture)
|
||||
.map_err(|_| TransferError::InvalidTextureId(source.texture))?;
|
||||
let src_texture = hub.textures.strict_get(source.texture).get()?;
|
||||
let dst_texture = hub.textures.strict_get(destination.texture).get()?;
|
||||
|
||||
src_texture.same_device_as(cmd_buf.as_ref())?;
|
||||
dst_texture.same_device_as(cmd_buf.as_ref())?;
|
||||
|
||||
Reference in new issue
Block a user