mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-30 10:03:58 +01:00
introduce Device.check_is_valid
This commit is contained in:
1 parent
508ece312d
commit
edc2cd9615
9 files changed
+84
-98
No files matched your search
@@ -9,7 +9,7 @@ use crate::{
|
||||
get_lowest_common_denom,
|
||||
global::Global,
|
||||
hal_api::HalApi,
|
||||
id::{BufferId, CommandEncoderId, DeviceId, TextureId},
|
||||
id::{BufferId, CommandEncoderId, TextureId},
|
||||
init_tracker::{MemoryInitKind, TextureInitRange},
|
||||
resource::{ParentDevice, Resource, Texture, TextureClearMode},
|
||||
snatch::SnatchGuard,
|
||||
@@ -26,8 +26,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("Device {0:?} is invalid")]
|
||||
InvalidDevice(DeviceId),
|
||||
#[error("Buffer {0:?} is invalid or destroyed")]
|
||||
InvalidBuffer(BufferId),
|
||||
#[error("Texture {0:?} is invalid or destroyed")]
|
||||
@@ -238,9 +236,7 @@ impl Global {
|
||||
}
|
||||
|
||||
let device = &cmd_buf.device;
|
||||
if !device.is_valid() {
|
||||
return Err(ClearError::InvalidDevice(cmd_buf.device.as_info().id()));
|
||||
}
|
||||
device.check_is_valid()?;
|
||||
let (encoder, tracker) = cmd_buf_data.open_encoder_and_tracker()?;
|
||||
|
||||
let snatch_guard = device.snatchable_lock.read();
|
||||
|
||||
Reference in new issue
Block a user