mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Remove TextureInner::Surface::has_work. (#5200)
When no work is submitted for a frame, presenting the surface results in a timeout due to no work having been submitted. Fixes #3189. This flag was added in #1892 with a note that it was going to be temporary until #1688 landed.
This commit is contained in:
@@ -110,6 +110,7 @@ Bottom level categories:
|
||||
- Device lost callbacks are invoked when replaced and when global is dropped. By @bradwerth in [#5168](https://github.com/gfx-rs/wgpu/pull/5168)
|
||||
- Fix panic when creating a surface while no backend is available. By @wumpf [#5166](https://github.com/gfx-rs/wgpu/pull/5166)
|
||||
- Correctly compute minimum buffer size for array-typed `storage` and `uniform` vars. By @jimblandy [#5222](https://github.com/gfx-rs/wgpu/pull/5222)
|
||||
- Fix timeout when presenting a surface where no work has been done. By @waywardmonkeys in [#5200](https://github.com/gfx-rs/wgpu/pull/5200)
|
||||
|
||||
#### WGL
|
||||
|
||||
|
||||
@@ -1222,13 +1222,7 @@ impl Global {
|
||||
return Err(QueueSubmitError::DestroyedTexture(id));
|
||||
}
|
||||
Some(TextureInner::Native { .. }) => false,
|
||||
Some(TextureInner::Surface {
|
||||
ref has_work,
|
||||
ref raw,
|
||||
..
|
||||
}) => {
|
||||
has_work.store(true, Ordering::Relaxed);
|
||||
|
||||
Some(TextureInner::Surface { ref raw, .. }) => {
|
||||
if raw.is_some() {
|
||||
submit_surface_textures_owned.push(texture.clone());
|
||||
}
|
||||
@@ -1423,13 +1417,7 @@ impl Global {
|
||||
return Err(QueueSubmitError::DestroyedTexture(id));
|
||||
}
|
||||
Some(TextureInner::Native { .. }) => {}
|
||||
Some(TextureInner::Surface {
|
||||
ref has_work,
|
||||
ref raw,
|
||||
..
|
||||
}) => {
|
||||
has_work.store(true, Ordering::Relaxed);
|
||||
|
||||
Some(TextureInner::Surface { ref raw, .. }) => {
|
||||
if raw.is_some() {
|
||||
submit_surface_textures_owned.push(texture.clone());
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@ When this texture is presented, we remove it from the device tracker as well as
|
||||
extract it from the hub.
|
||||
!*/
|
||||
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
use std::borrow::Borrow;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use crate::device::trace::Action;
|
||||
@@ -213,7 +210,6 @@ impl Global {
|
||||
inner: Snatchable::new(resource::TextureInner::Surface {
|
||||
raw: Some(ast.texture),
|
||||
parent_id: surface_id,
|
||||
has_work: AtomicBool::new(false),
|
||||
}),
|
||||
device: device.clone(),
|
||||
desc: texture_desc,
|
||||
@@ -331,15 +327,10 @@ impl Global {
|
||||
resource::TextureInner::Surface {
|
||||
ref mut raw,
|
||||
ref parent_id,
|
||||
ref has_work,
|
||||
} => {
|
||||
if surface_id != *parent_id {
|
||||
log::error!("Presented frame is from a different surface");
|
||||
Err(hal::SurfaceError::Lost)
|
||||
} else if !has_work.load(Ordering::Relaxed) {
|
||||
log::error!("No work has been submitted for this frame");
|
||||
unsafe { suf.unwrap().discard_texture(raw.take().unwrap()) };
|
||||
Err(hal::SurfaceError::Outdated)
|
||||
} else {
|
||||
unsafe {
|
||||
queue
|
||||
@@ -420,11 +411,7 @@ impl Global {
|
||||
let suf = A::get_surface(&surface);
|
||||
let exclusive_snatch_guard = device.snatchable_lock.write();
|
||||
match texture.inner.snatch(exclusive_snatch_guard).unwrap() {
|
||||
resource::TextureInner::Surface {
|
||||
mut raw,
|
||||
parent_id,
|
||||
has_work: _,
|
||||
} => {
|
||||
resource::TextureInner::Surface { mut raw, parent_id } => {
|
||||
if surface_id == parent_id {
|
||||
unsafe { suf.unwrap().discard_texture(raw.take().unwrap()) };
|
||||
} else {
|
||||
|
||||
@@ -31,7 +31,7 @@ use std::{
|
||||
ops::Range,
|
||||
ptr::NonNull,
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc, Weak,
|
||||
},
|
||||
};
|
||||
@@ -717,7 +717,6 @@ pub(crate) enum TextureInner<A: HalApi> {
|
||||
Surface {
|
||||
raw: Option<A::SurfaceTexture>,
|
||||
parent_id: SurfaceId,
|
||||
has_work: AtomicBool,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user