Skip to content

Commit

Permalink
Halt iteration of a gl fence when we find the first unsignalled sync …
Browse files Browse the repository at this point in the history
…object
  • Loading branch information
Dinnerbone committed Oct 20, 2024
1 parent b3f665b commit 840de2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wgpu-hal/src/gles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,16 @@ impl Fence {
fn get_latest(&self, gl: &glow::Context) -> crate::FenceValue {
let mut max_value = self.last_completed;
for &(value, sync) in self.pending.iter() {
if value <= max_value {
// We already know this was good, no need to check again
continue;
}
let status = unsafe { gl.get_sync_status(sync) };
if status == glow::SIGNALED {
max_value = value;
} else {
// Anything after the first unsignalled is guaranteed to also be unsignalled
break;
}
}
max_value
Expand Down

0 comments on commit 840de2d

Please sign in to comment.