From e1f0770b1d8767239d1c4adb839c522a6edffd48 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 3 Jan 2024 13:51:32 +0100 Subject: [PATCH] Rename Texture::as_raw into Texture::raw For consistency with Buffer::raw. --- wgpu-core/src/command/clear.rs | 2 +- wgpu-core/src/command/mod.rs | 2 +- wgpu-core/src/command/transfer.rs | 8 ++++---- wgpu-core/src/device/queue.rs | 8 ++++---- wgpu-core/src/device/resource.rs | 2 +- wgpu-core/src/resource.rs | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wgpu-core/src/command/clear.rs b/wgpu-core/src/command/clear.rs index 3b66c162f90..3a6ef14e379 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 fbce490599a..dabd8999083 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 32723f32bbe..048705c5941 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -823,7 +823,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( @@ -961,7 +961,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()); @@ -1175,7 +1175,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()); @@ -1193,7 +1193,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 bdd74c6e0e9..76596867205 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() @@ -1452,7 +1452,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 2c279688b99..444c4239e45 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 ed7cd1d7a9d..37c95731e04 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); }