mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Create a seperate event for each fence wait. (#8273)
* create an event per fence wait * Use seperate event for each `wait_for_present_queue_idle` call. * changelog
This commit is contained in:
parent
61e5124eb9
commit
f1c876c875
@ -214,6 +214,7 @@ By @cwfitzgerald in [#8162](https://github.com/gfx-rs/wgpu/pull/8162).
|
||||
|
||||
#### DX12
|
||||
|
||||
- Create an event per wait to prevent 60 second hangs in certain multithreaded scenarios. By @Vecvec in [#8273](https://github.com/gfx-rs/wgpu/pull/8273).
|
||||
- Fixed a bug where access to matrices with 2 rows would not work in some cases. By @andyleiserson in [#7438](https://github.com/gfx-rs/wgpu/pull/7438).
|
||||
|
||||
##### EGL
|
||||
|
||||
@ -195,10 +195,7 @@ impl super::Device {
|
||||
Ok(super::Device {
|
||||
raw: raw.clone(),
|
||||
present_queue,
|
||||
idler: super::Idler {
|
||||
fence: idle_fence,
|
||||
event: Event::create(false, false)?,
|
||||
},
|
||||
idler: super::Idler { fence: idle_fence },
|
||||
features,
|
||||
shared: Arc::new(shared),
|
||||
rtv_pool: Arc::new(Mutex::new(rtv_pool)),
|
||||
@ -256,16 +253,14 @@ impl super::Device {
|
||||
return Err(crate::DeviceError::Lost);
|
||||
}
|
||||
|
||||
let event = Event::create(false, false)?;
|
||||
|
||||
let value = cur_value + 1;
|
||||
unsafe { self.present_queue.Signal(&self.idler.fence, value) }
|
||||
.into_device_result("Signal")?;
|
||||
let hr = unsafe {
|
||||
self.idler
|
||||
.fence
|
||||
.SetEventOnCompletion(value, self.idler.event.0)
|
||||
};
|
||||
let hr = unsafe { self.idler.fence.SetEventOnCompletion(value, event.0) };
|
||||
hr.into_device_result("Set event")?;
|
||||
unsafe { Threading::WaitForSingleObject(self.idler.event.0, Threading::INFINITE) };
|
||||
unsafe { Threading::WaitForSingleObject(event.0, Threading::INFINITE) };
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -2252,7 +2247,9 @@ impl crate::Device for super::Device {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
unsafe { fence.raw.SetEventOnCompletion(value, self.idler.event.0) }
|
||||
let event = Event::create(false, false)?;
|
||||
|
||||
unsafe { fence.raw.SetEventOnCompletion(value, event.0) }
|
||||
.into_device_result("Set event")?;
|
||||
|
||||
let start_time = Instant::now();
|
||||
@ -2288,7 +2285,7 @@ impl crate::Device for super::Device {
|
||||
|
||||
match unsafe {
|
||||
Threading::WaitForSingleObject(
|
||||
self.idler.event.0,
|
||||
event.0,
|
||||
remaining_wait_duration.as_millis().try_into().unwrap(),
|
||||
)
|
||||
} {
|
||||
|
||||
@ -653,7 +653,6 @@ impl Drop for Event {
|
||||
/// Helper structure for waiting for GPU.
|
||||
struct Idler {
|
||||
fence: Direct3D12::ID3D12Fence,
|
||||
event: Event,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user