From 61c84f956ee84ceeb9f008d1eaad1064bdabad7b Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:41:48 +0200 Subject: [PATCH] Remove outdated locking comments We should rely on the ranks in `wgpu-core\src\lock\rank.rs`. --- wgpu-core/src/device/resource.rs | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 48e065d78e..eba5a30bb6 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -57,24 +57,6 @@ use super::{ /// Structure describing a logical device. Some members are internally mutable, /// stored behind mutexes. -/// -/// TODO: establish clear order of locking for these: -/// `life_tracker`, `trackers`, `render_passes`, `pending_writes`, `trace`. -/// -/// Currently, the rules are: -/// 1. `life_tracker` is locked after `hub.devices`, enforced by the type system -/// 1. `self.trackers` is locked last (unenforced) -/// 1. `self.trace` is locked last (unenforced) -/// -/// Right now avoid locking twice same resource or registry in a call execution -/// and minimize the locking to the minimum scope possible -/// Unless otherwise specified, no lock may be acquired while holding another lock. -/// This means that you must inspect function calls made while a lock is held -/// to see what locks the callee may try to acquire. -/// -/// Important: -/// When locking pending_writes please check that trackers is not locked -/// trackers should be locked only when needed for the shortest time possible pub struct Device { raw: ManuallyDrop>, pub(crate) adapter: Arc, @@ -124,13 +106,9 @@ pub struct Device { /// using ref-counted references for internal access. pub(crate) valid: AtomicBool, - /// All live resources allocated with this [`Device`]. - /// - /// Has to be locked temporarily only (locked last) - /// and never before pending_writes + /// Stores the state of buffers and textures. pub(crate) trackers: Mutex, pub(crate) tracker_indices: TrackerIndexAllocators, - // Life tracker should be locked right after the device and before anything else. life_tracker: Mutex, /// Pool of bind group layouts, allowing deduplication. pub(crate) bgl_pool: ResourcePool,