mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 07:21:04 +01:00
Fix lock issues affecting mark_externally_initialized test
- `RwLockReadGuard::forget` was not actually forgetting the `LockStateGuard`, resulting in a "double unlock" error when `SnatchableResourceGuard` later called `force_unlock_read`. - Adjust both the test and the lock graph to avoid lock rank errors.
This commit is contained in:
1 parent
468e87264a
commit
b9f7ddad53
3 files changed
+8
-2
No files matched your search
@@ -2926,7 +2926,6 @@ async fn check_mark_externally_initialized_case<A: hal::Api>(ctx: &TestingContex
|
||||
// by wgpu-core.
|
||||
unsafe {
|
||||
let hal_device = ctx.device.as_hal::<A>().expect("adapter backend mismatch");
|
||||
let hal_texture = texture.as_hal::<A>().expect("adapter backend mismatch");
|
||||
|
||||
let (staging_buffer, _allocated_size) = hal_device
|
||||
.create_buffer(&hal::BufferDescriptor {
|
||||
@@ -2947,6 +2946,7 @@ async fn check_mark_externally_initialized_case<A: hal::Api>(ctx: &TestingContex
|
||||
hal_device.unmap_buffer(&staging_buffer);
|
||||
}
|
||||
|
||||
let hal_texture = texture.as_hal::<A>().expect("adapter backend mismatch");
|
||||
let mut encoder = ctx
|
||||
.device
|
||||
.create_command_encoder(&CommandEncoderDescriptor { label: None });
|
||||
|
||||
@@ -121,11 +121,13 @@ define_lock_ranks! {
|
||||
}
|
||||
rank DEVICE_SNATCHABLE_LOCK "Device::snatchable_lock" followed by {
|
||||
BUFFER_MAP_STATE,
|
||||
COMMAND_BUFFER_DATA,
|
||||
DEVICE_COMMAND_INDICES,
|
||||
QUEUE_PENDING_WRITES,
|
||||
DEVICE_TRACKERS,
|
||||
QUEUE_LIFE_TRACKER,
|
||||
BLAS_COMPACTION_STATE,
|
||||
COMMAND_ALLOCATOR_FREE_ENCODERS,
|
||||
BUFFER_BIND_GROUPS,
|
||||
BUFFER_INITIALIZATION_STATUS,
|
||||
BUFFER_POOL,
|
||||
|
||||
@@ -334,9 +334,13 @@ impl<'a, T> RwLockReadGuard<'a, T> {
|
||||
// Equivalent to std::mem::forget, but preserves the information about the lock
|
||||
// rank.
|
||||
pub fn forget(this: Self) -> RankData {
|
||||
// Skip `Drop` for both the actual lock guard (`this.inner`) and the
|
||||
// rank-checking state guard (`this.saved`)
|
||||
let saved = core::mem::ManuallyDrop::new(this.saved);
|
||||
core::mem::forget(this.inner);
|
||||
|
||||
this.saved.0
|
||||
// Return the `RankData` so the caller can pass it to `force_unlock_read`.
|
||||
saved.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user