[core] Simplify self types in device::resource.

Change various functions that have no need to create an owning
reference to the `Device` to accept `&self` instead of `&Arc<Self>`.

Change `ParentDevice::same_device` to accept `&Device` as the point of
comparison, not `&Arc<Device>`. Call sites will use Deref conversion,
so no callers need to be changed.
This commit is contained in:
Jim Blandy 2024-09-02 12:06:58 -07:00 committed by Erich Gubler
parent 504ff3e1a6
commit 9d24406d29
2 changed files with 6 additions and 6 deletions

View File

@ -1882,7 +1882,7 @@ impl Device {
}
pub(crate) fn create_buffer_binding<'a>(
self: &Arc<Self>,
&self,
bb: &'a binding_model::ResolvedBufferBinding,
binding: u32,
decl: &wgt::BindGroupLayoutEntry,
@ -2020,7 +2020,7 @@ impl Device {
}
fn create_sampler_binding<'a>(
self: &Arc<Self>,
&self,
used: &mut BindGroupStates,
binding: u32,
decl: &wgt::BindGroupLayoutEntry,
@ -2069,7 +2069,7 @@ impl Device {
}
pub(crate) fn create_texture_binding<'a>(
self: &Arc<Self>,
&self,
binding: u32,
decl: &wgt::BindGroupLayoutEntry,
view: &'a Arc<TextureView>,
@ -2359,7 +2359,7 @@ impl Device {
}
pub(crate) fn texture_use_parameters(
self: &Arc<Self>,
&self,
binding: u32,
decl: &wgt::BindGroupLayoutEntry,
view: &TextureView,

View File

@ -106,8 +106,8 @@ pub(crate) trait ParentDevice: Labeled {
}
}
fn same_device(&self, device: &Arc<Device>) -> Result<(), DeviceError> {
if Arc::ptr_eq(self.device(), device) {
fn same_device(&self, device: &Device) -> Result<(), DeviceError> {
if std::ptr::eq(&**self.device(), device) {
Ok(())
} else {
Err(DeviceError::DeviceMismatch(Box::new(DeviceMismatch {