diff --git a/wgpu-core/src/command/clear.rs b/wgpu-core/src/command/clear.rs index 3b66c162f..3a6ef14e3 100644 --- a/wgpu-core/src/command/clear.rs +++ b/wgpu-core/src/command/clear.rs @@ -254,7 +254,7 @@ pub(crate) fn clear_texture( ) -> Result<(), ClearError> { let snatch_guard = dst_texture.device.snatchable_lock.read(); let dst_raw = dst_texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or_else(|| ClearError::InvalidTexture(dst_texture.as_info().id()))?; // Issue the right barrier. diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index fbce49059..dabd89990 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -230,7 +230,7 @@ impl CommandBuffer { let texture_barriers = transitions .into_iter() .enumerate() - .map(|(i, p)| p.into_hal(textures[i].unwrap().as_raw().unwrap())); + .map(|(i, p)| p.into_hal(textures[i].unwrap().raw().unwrap())); unsafe { raw.transition_buffers(buffer_barriers); diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index 15d5ac5e1..9f8f8dfc3 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -812,7 +812,7 @@ impl Global { .set_single(&dst_texture, dst_range, hal::TextureUses::COPY_DST) .ok_or(TransferError::InvalidTexture(destination.texture))?; let dst_raw = dst_texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(destination.texture))?; if !dst_texture.desc.usage.contains(TextureUsages::COPY_DST) { return Err( @@ -949,7 +949,7 @@ impl Global { .set_single(&src_texture, src_range, hal::TextureUses::COPY_SRC) .ok_or(TransferError::InvalidTexture(source.texture))?; let src_raw = src_texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(source.texture))?; if !src_texture.desc.usage.contains(TextureUsages::COPY_SRC) { return Err(TransferError::MissingCopySrcUsageFlag.into()); @@ -1163,7 +1163,7 @@ impl Global { .set_single(&src_texture, src_range, hal::TextureUses::COPY_SRC) .ok_or(TransferError::InvalidTexture(source.texture))?; let src_raw = src_texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(source.texture))?; if !src_texture.desc.usage.contains(TextureUsages::COPY_SRC) { return Err(TransferError::MissingCopySrcUsageFlag.into()); @@ -1181,7 +1181,7 @@ impl Global { .set_single(&dst_texture, dst_range, hal::TextureUses::COPY_DST) .ok_or(TransferError::InvalidTexture(destination.texture))?; let dst_raw = dst_texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(destination.texture))?; if !dst_texture.desc.usage.contains(TextureUsages::COPY_DST) { return Err( diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 917d3a79e..eacf4d4b3 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -813,7 +813,7 @@ impl Global { .use_at(device.active_submission_index.load(Ordering::Relaxed) + 1); let dst_raw = dst - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(destination.texture))?; let bytes_per_row = data_layout @@ -1075,7 +1075,7 @@ impl Global { let snatch_guard = device.snatchable_lock.read(); let dst_raw = dst - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(TransferError::InvalidTexture(destination.texture))?; let regions = hal::TextureCopy { @@ -1397,7 +1397,7 @@ impl Global { let texture_barriers = transitions .into_iter() .enumerate() - .map(|(i, p)| p.into_hal(textures[i].unwrap().as_raw().unwrap())); + .map(|(i, p)| p.into_hal(textures[i].unwrap().raw().unwrap())); let present = unsafe { baked.encoder.transition_textures(texture_barriers); baked.encoder.end_encoding().unwrap() @@ -1450,7 +1450,7 @@ impl Global { let texture_barriers = transitions .into_iter() .enumerate() - .map(|(i, p)| p.into_hal(textures[i].unwrap().as_raw().unwrap())); + .map(|(i, p)| p.into_hal(textures[i].unwrap().raw().unwrap())); unsafe { pending_writes .command_encoder diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 6d3a8e415..b212dc575 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -908,7 +908,7 @@ impl Device { let snatch_guard = texture.device.snatchable_lock.read(); let texture_raw = texture - .as_raw(&snatch_guard) + .raw(&snatch_guard) .ok_or(resource::CreateTextureViewError::InvalidTexture)?; // resolve TextureViewDescriptor defaults diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index ed7cd1d7a..37c95731e 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -719,7 +719,7 @@ pub(crate) enum TextureInner { } impl TextureInner { - pub fn as_raw(&self) -> Option<&A::Texture> { + pub fn raw(&self) -> Option<&A::Texture> { match self { Self::Native { raw } => Some(raw), Self::Surface { raw: Some(tex), .. } => Some(tex.borrow()), @@ -797,8 +797,8 @@ impl Drop for Texture { } impl Texture { - pub(crate) fn as_raw<'a>(&'a self, snatch_guard: &'a SnatchGuard) -> Option<&'a A::Texture> { - self.inner.get(snatch_guard)?.as_raw() + pub(crate) fn raw<'a>(&'a self, snatch_guard: &'a SnatchGuard) -> Option<&'a A::Texture> { + self.inner.get(snatch_guard)?.raw() } pub(crate) fn inner_mut<'a>( @@ -852,7 +852,7 @@ impl Global { let texture_opt = { hub.textures.try_get(id).ok().flatten() }; let texture = texture_opt.as_ref().unwrap(); let snatch_guard = texture.device.snatchable_lock.read(); - let hal_texture = texture.as_raw(&snatch_guard); + let hal_texture = texture.raw(&snatch_guard); hal_texture_callback(hal_texture); }