gfx-rs/wgpu · error

GetTimestampFrequency

Error message

GetTimestampFrequency

What it means

Panic marked GetTimestampFrequency: querying the swapchain's timestamp frequency (needed to normalize presentation timing) returned a failing HRESULT, so the timing data cannot be interpreted. The faulty input is the DXGI swapchain/driver state.

Source

Thrown at wgpu-hal/src/dx12/mod.rs:1744

        let (interval, flags) = match sc.present_mode {
            // We only allow immediate if ALLOW_TEARING is valid.
            wgt::PresentMode::Immediate => (0, Dxgi::DXGI_PRESENT_ALLOW_TEARING),
            wgt::PresentMode::Mailbox => (0, Dxgi::DXGI_PRESENT::default()),
            wgt::PresentMode::Fifo => (1, Dxgi::DXGI_PRESENT::default()),
            m => unreachable!("Cannot make surface with present mode {m:?}"),
        };

        profiling::scope!("IDXGISwapchain3::Present");
        unsafe { sc.raw.Present(interval, flags) }
            .ok()
            .into_device_result("Present")?;

        Ok(())
    }

    unsafe fn get_timestamp_period(&self) -> f32 {
        let frequency = unsafe { self.raw.GetTimestampFrequency() }.expect("GetTimestampFrequency");
        (1_000_000_000.0 / frequency as f64) as f32
    }

    unsafe fn wait_for_idle(&self) -> Result<(), crate::DeviceError> {
        let value = self
            .idle_fence_value
            .fetch_add(1, core::sync::atomic::Ordering::Relaxed)
            + 1;
        unsafe { self.raw.Signal(&self.idle_fence, value) }
            .into_device_result("Signal idle fence")?;
        unsafe {
            self.idle_fence
                .SetEventOnCompletion(value, self.idle_event.0)
        }
        .into_device_result("SetEventOnCompletion")?;
        unsafe { Threading::WaitForSingleObject(self.idle_event.0, Threading::INFINITE) };
        Ok(())
    }

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Report the driver/swapchain incompatibility; avoid timing-sensitive presentation features on it
  2. Ensure the surface was configured before presenting and that the swapchain is valid
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at wgpu-hal/src/dx12/mod.rs:1744 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/be8a4218b64d1aad. Report an issue: GitHub.