Skip to content

Commit e9b8bb2

Browse files
committed
Review Comments
1 parent a19af1f commit e9b8bb2

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

tests/src/init.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ pub fn initialize_instance(backends: wgpu::Backends, force_fxc: bool) -> Instanc
4444
},
4545
gl: wgpu::GlBackendOptions {
4646
fence_behavior: if cfg!(target_family = "wasm") {
47+
// On WebGL, you cannot call Poll(Wait) with any timeout. This is because the
48+
// browser does not things to block. However all of our tests are written to
49+
// expect this behavior. This is the workaround to allow this to work.
50+
//
51+
// However on native you can wait, so we want to ensure that behavior as well.
4752
wgpu::GlFenceBehavior::AutoFinish
4853
} else {
4954
wgpu::GlFenceBehavior::Normal

wgpu-core/src/device/global.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,8 @@ impl Global {
18781878
// We're happy
18791879
Ok(wgt::PollStatus::QueueEmpty) => {}
18801880
Ok(wgt::PollStatus::WaitSucceeded) => {
1881-
// After the wait, the queue should be empty.
1881+
// After the wait, the queue should be empty. It can only be non-empty
1882+
// if another thread is submitting at the same time.
18821883
break 'error E::GpuWaitTimeout;
18831884
}
18841885
Ok(wgt::PollStatus::Poll) => {

wgpu-core/src/device/resource.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl Device {
477477
let result = if queue_empty {
478478
if let Some(wait_submission_index) = wait_submission_index {
479479
// Assert to ensure that if we received a queue empty status, the fence shows the correct value.
480-
// This is defencive, as this should never be hit.
480+
// This is defensive, as this should never be hit.
481481
assert!(
482482
current_finished_submission >= wait_submission_index,
483483
"If the queue is empty, the current submission index ({}) should be at least the wait submission index ({})",

wgpu-types/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,7 +4041,7 @@ impl<T> PollType<T> {
40414041
}
40424042
}
40434043

4044-
/// Error states after a poll
4044+
/// Error states after a device poll
40454045
#[derive(Debug)]
40464046
#[cfg_attr(feature = "std", derive(thiserror::Error))]
40474047
pub enum PollError {
@@ -4053,7 +4053,7 @@ pub enum PollError {
40534053
Timeout,
40544054
}
40554055

4056-
/// Status of poll operation.
4056+
/// Status of device poll operation.
40574057
#[derive(Debug, PartialEq, Eq)]
40584058
pub enum PollStatus {
40594059
/// There are no active submissions in flight as of the beginning of the poll call.

wgpu/src/api/surface.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ impl Surface<'_> {
7575

7676
/// Initializes [`Surface`] for presentation.
7777
///
78+
/// If the surface is already configured, this will wait for the GPU to come idle
79+
/// before recreating the swapchain to prevent race conditions.
80+
///
81+
/// # Validation Errors
82+
/// - Submissions that happen _during_ the configure may cause the
83+
/// internal wait-for-idle to fail, raising a validation error.
84+
///
7885
/// # Panics
7986
///
8087
/// - A old [`SurfaceTexture`] is still alive referencing an old surface.

0 commit comments

Comments
 (0)