Expand description
Per-pass GPU timing slot arithmetic, shared by every backend that times passes with a timestamp query pool.
The pool holds one block of SLOTS_PER_FRAME u64 slots per in-flight
frame. Within a block the whole-frame timer owns slots [0, 1] and one
(start, end) pair per PassId follows, so pass occupies
2 + 2 * pass and 3 + 2 * pass. Keeping the whole-frame pair at the front
lets a whole-frame readback stay the first pair of the block, independent of
how many passes exist.
This is index arithmetic with no device type in it, so it lives here rather
than in a backend and its layout tests run on every platform’s CI. The
DirectX and Vulkan backends re-export it under their own pass_timing.
Constants§
- FRAME_
BLOCK_ BYTES - Bytes one frame’s block occupies in a readback buffer of u64 timestamps.
- SLOTS_
PER_ FRAME - Per-frame block:
[whole_frame_start, whole_frame_end, pass0_start, pass0_end, ..., pass(PASS_COUNT-1)_end].
Functions§
- frame_
block_ base - First slot of
frame’s block. Also the start of the range a per-frame resolve should walk, paired withSLOTS_PER_FRAMEas the count. - frame_
readback_ byte_ offset - Byte offset into the readback buffer where
frame’s block begins. - pass_
pair - (start, end) slots for
passwithinframe’s block. - whole_
frame_ pair - (start, end) slots for
frame’s whole-frame pair.