Commit Graph
25 Commits
Author SHA1 Message Date
teoxoy 31edbfd0dc [wgpu-core] use .strict_get() & .strict_unregister() for command buffers
We now only rely on the presence of the inner `CommandBufferMutable` to determine if command buffers are invalid.
2024-09-10 11:58:54 +02:00
Erich Gubler ec21000521 refactor: lock::observing: extract fn addr from ref. conv. to usize 2024-09-05 11:08:51 -04:00
Erich Gubler 63a24d37c3 chore: satisfy clippy::ref_as_ptr 2024-09-05 11:08:51 -04:00
Jim Blandy bbdbafdf8a [core] Add lock::observing module, for analyzing lock acquisition.
Add a new module `lock::observing`, enabled by the `observe-locks`
feature, that records all nested lock acquisitions in trace files.

Add a new utility to the workspace, `lock-analyzer`, that reads the
files written by the `observe-locks` feature and writes out a new
`define_lock_ranks!` macro invocation that covers all observed lock
usage, along with comments giving the held and acquired source
locations.
2024-08-28 22:44:20 -04:00
Jim Blandy f56914cea9 [core] Rename LockRankSet::name to member_name. 2024-08-28 22:44:20 -04:00
teoxoy c72bc7b84b remove unnecessary RwLock from Texture.clear_mode 2024-08-13 00:55:32 +02:00
teoxoy f0875e8fda remove Buffer.sync_mapped_writes
`zero_init_needs_flush_now` was always equal to `mapping.is_coherent`
which is not correct but is fixed by the next commit.
2024-08-12 14:20:56 +01:00
teoxoy 826e3716e5 remove all internal RenderBundleScope RwLocks 2024-08-03 11:58:14 +02:00
teoxoy 3a5ad193db remove all internal BindGroupState Mutexes 2024-08-03 11:58:14 +02:00
teoxoy 14170fd963 remove unused RenderBundleScope.query_sets 2024-08-03 11:58:14 +02:00
teoxoy 4d285d8b61 remove the Mutex around StagingBuffer's internal buffer 2024-07-12 16:33:57 +02:00
teoxoy 3142e15907 remove the triage suspected machinery 2024-07-09 10:48:52 +02:00
Erich Gubler 702c8cb693 style: strip trailing whitespace from lock::ranked module (#5815) 2024-06-14 13:45:34 -04:00
Jim Blandy 7c842a3b48 [core] Implement downgrade for the lock module's RwLocks.
Implement `RwLockWriteGuard::downgrade` for `lock::vanilla` and
`lock::ranked`, to downgrade a write lock to a read lock.
2024-05-03 13:06:00 -04:00
Jim Blandy 651214ef74 [core] Refactor lock::ranked to use LockStateGuard.
Rather than implementing `Drop` for all three lock guard types to
restore the lock analysis' per-thread state, let lock guards own
values of a new type, `LockStateGuard`, with the appropriate `Drop`
implementation. This is cleaner and shorter, and helps us implement
`RwLock::downgrade` in a later commit.
2024-05-03 13:06:00 -04:00
Jim Blandy d4f30638b7 [core] Fix caller location tracking in lock::ranked.
Properly track the location of callers of `Mutex::lock`,
`RwLock::read`, and `RwLock::write`, for use in panic messages.
2024-04-25 12:46:05 -07:00
Jim Blandy a364e566cd [core] Use lock::RwLock in RenderBundleScope.
This requires bumping the `LockRankSet` bitset from `u32` to `u64`.
2024-04-25 01:28:21 -04:00
Jim Blandy 927b7e96fe [core] Use lock::RwLock in Registry. 2024-04-25 01:28:21 -04:00
Jim Blandy 36e0a135f5 [core] Use lock::RwLock in Buffer and Texture. 2024-04-25 01:28:21 -04:00
Jim Blandy d089b86c59 [core] Include SnatchLock in lock rankings. 2024-04-25 01:28:21 -04:00
Jim Blandy 43f2315753 [core] Add checked RwLock. 2024-04-25 01:28:21 -04:00
Jim Blandy 7d9a8beff3 [core] Abstract out checking code in lock::ranked.
Introduce two new private functions, `acquire` and `release`, to the
`lock::ranked` module, to perform validation for acquiring and
releasing locks. Change `Mutex::lock` and `MutexGuard::drop` to use
those functions, rather than writing out their contents.
2024-04-25 01:28:21 -04:00
Jim Blandy d719373989 [core] Remove unnecessary #[inline] attributes in lock module. 2024-04-25 01:28:21 -04:00
Jim Blandy 3c21a98697 [core] Remove semicolon from lock rank macro syntax.
In `define_lock_ranks!` macro invocations, don't require a semicolon
after each rank's "followed by" list.
2024-04-25 01:28:21 -04:00
Jim Blandy b3c5a6fb84 [core] Enforce a deadlock-free locking order for Mutexes.
If `debug_assertions` or the `"validate-locks"` feature are enabled,
change `wgpu-core` to use a wrapper around `parking_lot::Mutex` that
checks for potential deadlocks.

At the moment, `wgpu-core` does contain deadlocks, so the ranking in
the `lock::rank` module is incomplete, in the interests of keeping it
acyclic. #5572 tracks the work needed to complete the ranking.
2024-04-22 18:49:03 -07:00