Skip to content

Commit 9d24406

Browse files
jimblandyErichDonGubler
authored andcommitted
[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.
1 parent 504ff3e commit 9d24406

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

wgpu-core/src/device/resource.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ impl Device {
18821882
}
18831883

18841884
pub(crate) fn create_buffer_binding<'a>(
1885-
self: &Arc<Self>,
1885+
&self,
18861886
bb: &'a binding_model::ResolvedBufferBinding,
18871887
binding: u32,
18881888
decl: &wgt::BindGroupLayoutEntry,
@@ -2020,7 +2020,7 @@ impl Device {
20202020
}
20212021

20222022
fn create_sampler_binding<'a>(
2023-
self: &Arc<Self>,
2023+
&self,
20242024
used: &mut BindGroupStates,
20252025
binding: u32,
20262026
decl: &wgt::BindGroupLayoutEntry,
@@ -2069,7 +2069,7 @@ impl Device {
20692069
}
20702070

20712071
pub(crate) fn create_texture_binding<'a>(
2072-
self: &Arc<Self>,
2072+
&self,
20732073
binding: u32,
20742074
decl: &wgt::BindGroupLayoutEntry,
20752075
view: &'a Arc<TextureView>,
@@ -2359,7 +2359,7 @@ impl Device {
23592359
}
23602360

23612361
pub(crate) fn texture_use_parameters(
2362-
self: &Arc<Self>,
2362+
&self,
23632363
binding: u32,
23642364
decl: &wgt::BindGroupLayoutEntry,
23652365
view: &TextureView,

wgpu-core/src/resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ pub(crate) trait ParentDevice: Labeled {
106106
}
107107
}
108108

109-
fn same_device(&self, device: &Arc<Device>) -> Result<(), DeviceError> {
110-
if Arc::ptr_eq(self.device(), device) {
109+
fn same_device(&self, device: &Device) -> Result<(), DeviceError> {
110+
if std::ptr::eq(&**self.device(), device) {
111111
Ok(())
112112
} else {
113113
Err(DeviceError::DeviceMismatch(Box::new(DeviceMismatch {

0 commit comments

Comments
 (0)