atagen

monolith

public
Star0
Watch0

Commit cabbef6c998a

tarball

atagen <boss@atagen.co>2026-10-16 13:48 UTC

1 file changed+7-0
render-vk: wait on render fences through their sync files

Waiting on a pending Vulkan fence sleeps in 10 ms steps on the NVIDIA driver, measured at a 10.06 ms median for work that finishes in under 200 us, which made every nested frame and every CPU wait cost a full 10 ms. Polling the exported sync_file wakes as soon as the GPU signals, at a 15 us median.
Modified file: crates/render-vk/src/sync.rs+7 additions
@@ -53,7 +53,13 @@ impl FenceInner {
5353 }
5454 }
5555
56+ /// Blocks until the GPU signals. A pending fence is first turned into its
57+ /// sync_file and polled, because waiting on the Vulkan fence itself sleeps
58+ /// in 10 ms steps on NVIDIA even when the work is done in microseconds.
5659 pub fn wait(&self) -> Result<(), vk::Result> {
60+ if self.exportable {
61+ drop(self.export());
62+ }
5763 match &*self.state.lock().unwrap_or_else(|e| e.into_inner()) {
5864 State::Pending => unsafe {
5965 self.shared
@@ -69,6 +75,7 @@ impl FenceInner {
6975 }
7076 }
7177
78+ #[profiling::function]
7279 fn export(&self) -> Option<OwnedFd> {
7380 if !self.exportable {
7481 return None;