writeTimestamp(granularity:after:counterHeap:index:)
Writes a GPU timestamp into the given Mtl4counterheap at index after stage completes.
Declaration
func writeTimestamp(granularity: MTL4TimestampGranularity, after stage: MTLRenderStages, counterHeap: any MTL4CounterHeap, index: Int)Parameters
- granularity:
A Mtl4timestampgranularity hint.
- stage:
Mtlrenderstages that need to complete before Metal writes the timestamp. This may also include later stages that are related, for example Mesh may include Vertex.
- counterHeap:
Mtl4counterheap into which Metal writes timestamps.
- index:
The index value into which Metal writes this timestamp.
Discussion
This command only guarantees all draws prior to this command are complete when Metal writes the timestamp into the counter heap you provide in the counterHeap parameter. The timestamp may also include subsequent operations.
If you call this method before any draw calls, Metal writes a timestamp before the stage you specify in the stage parameter begins.