Rename Texture::as_raw into Texture::raw

For consistency with Buffer::raw.
This commit is contained in:
Nicolas Silva authored and Teodor Tanasoaia committed 2024-01-05 11:27:17 +01:00
1 parent bfe235a295
commit defd43dff2
6 files changed
+15 -15

No files matched your search

+1 -1
View File
@@ -254,7 +254,7 @@ pub(crate) fn clear_texture<A: HalApi>(
) -> 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.
+1 -1
View File
@@ -230,7 +230,7 @@ impl<A: HalApi> CommandBuffer<A> {
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);
+4 -4
View File
@@ -812,7 +812,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.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<G: GlobalIdentityHandlerFactory> Global<G> {
.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<G: GlobalIdentityHandlerFactory> Global<G> {
.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<G: GlobalIdentityHandlerFactory> Global<G> {
.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(
+4 -4
View File
@@ -813,7 +813,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.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<G: GlobalIdentityHandlerFactory> Global<G> {
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<G: GlobalIdentityHandlerFactory> Global<G> {
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<G: GlobalIdentityHandlerFactory> Global<G> {
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
+1 -1
View File
@@ -908,7 +908,7 @@ impl<A: HalApi> Device<A> {
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
+4 -4
View File
@@ -719,7 +719,7 @@ pub(crate) enum TextureInner<A: HalApi> {
}
impl<A: HalApi> TextureInner<A> {
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<A: HalApi> Drop for Texture<A> {
}
impl<A: HalApi> Texture<A> {
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<G: GlobalIdentityHandlerFactory> Global<G> {
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);
}