Vixen
02b45cc4
csharp
public static class GpuTimestamps

How a raw timestamp difference becomes a duration, and the one number a caller cannot guess.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A GPU timestamp is a tick of a clock whose rate is the device's business — Vulkan reports it as VkPhysicalDeviceLimits.timestampPeriod, nanoseconds per tick, and it is a float because on several vendors it is not an integer. Two readings subtracted give ticks; ticks times the period give nanoseconds. Nothing else about the value is portable, and in particular the zero point is not: a timestamp is comparable with another timestamp from the same device and with nothing at all on the CPU.

⚠ That is why a GPU timeline is drawn relative to its own first reading. Lining a GPU scope up against a CPU one needs a calibrated pair (VK_EXT_calibrated_timestamps), which is an extension a good many drivers do not have. Doc 13's frame breakdown is a GPU timeline beside a CPU one rather than a single merged track, and this is the reason.

Methods (2)

  • public static double ToNanoseconds(ulong ticks, float period)

    Turns a tick count into nanoseconds.

  • public static double ToMilliseconds(ulong ticks, float period)

    Turns a tick count into milliseconds.

Used by (2)

  • QueryPoolTestsVixen.Graphics.Null.Tests
  • GpuFrameVixen.Editor.Profiler