Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Ensure all lock guards are properly nested. #5646

Merged
merged 4 commits into from
May 3, 2024

Commits on May 2, 2024

  1. [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.
    jimblandy committed May 2, 2024
    Configuration menu
    Copy the full SHA
    68e36a7 View commit details
    Browse the repository at this point in the history
  2. [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.
    jimblandy committed May 2, 2024
    Configuration menu
    Copy the full SHA
    cf179ab View commit details
    Browse the repository at this point in the history
  3. [core] Ensure all lock guards are properly nested.

    The lock analyzers in the `wgpu_core::lock` module can be a bit
    simpler if they can assume that locks are acquired and released in a
    stack-like order: that a guard is only dropped when it is the most
    recently acquired lock guard still held. So:
    
    - Change `Device::maintain` to take a `RwLockReadGuard` for the device's
      hal fence, rather than just a reference to it.
    
    - Adjust the order in which guards are dropped in `Device::maintain`
      and `Queue::submit`.
    
    Fixes gfx-rs#5610.
    jimblandy committed May 2, 2024
    Configuration menu
    Copy the full SHA
    6e51fe6 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2024

  1. Configuration menu
    Copy the full SHA
    3a36786 View commit details
    Browse the repository at this point in the history