diff --git a/wgpu-core/src/device/ray_tracing.rs b/wgpu-core/src/device/ray_tracing.rs index 0e6ef8402a..50d963548d 100644 --- a/wgpu-core/src/device/ray_tracing.rs +++ b/wgpu-core/src/device/ray_tracing.rs @@ -285,12 +285,13 @@ impl Global { let hub = A::hub(self); let mut token = Token::root(); - let (last_submit_index, device_id) = { + let (last_submit_index, device_id, ref_count) = { let (mut blas_guard, _) = hub.blas_s.write(&mut token); match blas_guard.get_mut(blas_id) { Ok(blas) => { + let ref_count = blas.life_guard.ref_count.take().unwrap(); let last_submit_index = blas.life_guard.life_count(); - (last_submit_index, blas.device_id.value) + (last_submit_index, blas.device_id.value, ref_count) } Err(crate::hub::InvalidId) => { hub.blas_s.unregister_locked(blas_id, &mut *blas_guard); @@ -302,6 +303,7 @@ impl Global { let (device_guard, mut token) = hub.devices.read(&mut token); let device = &device_guard[device_id]; { + drop(ref_count); let mut life_lock = device.lock_life(&mut token); life_lock .suspected_resources @@ -368,12 +370,13 @@ impl Global { let hub = A::hub(self); let mut token = Token::root(); - let (last_submit_index, device_id) = { + let (last_submit_index, device_id, ref_count) = { let (mut tlas_guard, _) = hub.tlas_s.write(&mut token); match tlas_guard.get_mut(tlas_id) { Ok(tlas) => { + let ref_count = tlas.life_guard.ref_count.take().unwrap(); let last_submit_index = tlas.life_guard.life_count(); - (last_submit_index, tlas.device_id.value) + (last_submit_index, tlas.device_id.value, ref_count) } Err(crate::hub::InvalidId) => { hub.tlas_s.unregister_locked(tlas_id, &mut *tlas_guard); @@ -385,6 +388,7 @@ impl Global { let (device_guard, mut token) = hub.devices.read(&mut token); let device = &device_guard[device_id]; { + drop(ref_count); let mut life_lock = device.lock_life(&mut token); life_lock .suspected_resources