diff --git a/player/src/lib.rs b/player/src/lib.rs index 9ba9cfef4..8acdcd043 100644 --- a/player/src/lib.rs +++ b/player/src/lib.rs @@ -1,9 +1,5 @@ /*! This is a player library for WebGPU traces. * - * # Notes - * - we call device_maintain_ids() before creating any refcounted resource, - * which is basically everything except for BGL and shader modules, - * so that we don't accidentally try to use the same ID. !*/ #![cfg(not(target_arch = "wasm32"))] #![warn(unsafe_op_in_unsafe_fn)] @@ -153,7 +149,6 @@ impl GlobalPlay for wgc::global::Global { panic!("Unexpected Surface action: winit feature is not enabled") } Action::CreateBuffer(id, desc) => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_buffer::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -166,7 +161,6 @@ impl GlobalPlay for wgc::global::Global { self.buffer_drop::(id, true); } Action::CreateTexture(id, desc) => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_texture::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -183,7 +177,6 @@ impl GlobalPlay for wgc::global::Global { parent_id, desc, } => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.texture_create_view::(parent_id, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -193,7 +186,6 @@ impl GlobalPlay for wgc::global::Global { self.texture_view_drop::(id, true).unwrap(); } Action::CreateSampler(id, desc) => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_sampler::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -203,7 +195,6 @@ impl GlobalPlay for wgc::global::Global { self.sampler_drop::(id); } Action::GetSurfaceTexture { id, parent_id } => { - self.device_maintain_ids::(device).unwrap(); self.surface_get_current_texture::(parent_id, Some(id)) .unwrap() .texture_id @@ -219,7 +210,6 @@ impl GlobalPlay for wgc::global::Global { self.bind_group_layout_drop::(id); } Action::CreatePipelineLayout(id, desc) => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_pipeline_layout::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -229,7 +219,6 @@ impl GlobalPlay for wgc::global::Global { self.pipeline_layout_drop::(id); } Action::CreateBindGroup(id, desc) => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_bind_group::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); @@ -263,7 +252,6 @@ impl GlobalPlay for wgc::global::Global { desc, implicit_context, } => { - self.device_maintain_ids::(device).unwrap(); let implicit_ids = implicit_context .as_ref() @@ -285,7 +273,6 @@ impl GlobalPlay for wgc::global::Global { desc, implicit_context, } => { - self.device_maintain_ids::(device).unwrap(); let implicit_ids = implicit_context .as_ref() @@ -324,7 +311,6 @@ impl GlobalPlay for wgc::global::Global { self.render_bundle_drop::(id); } Action::CreateQuerySet { id, desc } => { - self.device_maintain_ids::(device).unwrap(); let (_, error) = self.device_create_query_set::(device, &desc, Some(id)); if let Some(e) = error { panic!("{e}"); diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index 2be55a48b..f2b875030 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -2247,23 +2247,6 @@ impl Global { Some(error) } - #[cfg(feature = "replay")] - /// Only triage suspected resource IDs. This helps us to avoid ID collisions - /// upon creating new resources when re-playing a trace. - pub fn device_maintain_ids(&self, device_id: DeviceId) -> Result<(), DeviceError> { - let hub = A::hub(self); - - let device = hub - .devices - .get(device_id) - .map_err(|_| DeviceError::InvalidDeviceId)?; - - device.check_is_valid()?; - - device.lock_life().triage_suspected(&device.trackers); - Ok(()) - } - /// Check `device_id` for freeable resources and completed buffer mappings. /// /// Return `queue_empty` indicating whether there are more queue submissions still in flight. diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 638c0d057..5700fdd31 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -76,11 +76,6 @@ use super::{ /// This means that you must inspect function calls made while a lock is held /// to see what locks the callee may try to acquire. /// -/// As far as this point: -/// device_maintain_ids locks Device::lifetime_tracker, and calls... -/// triage_suspected locks Device::trackers, and calls... -/// Registry::unregister locks Registry::storage -/// /// Important: /// When locking pending_writes please check that trackers is not locked /// trackers should be locked only when needed for the shortest time possible