Encodes a command to sample hardware counters at this point in the blit pass and store the samples into a counter sample buffer.
- macOS 10.15+
The sample buffer to sample into.
The index in the counter buffer to write the sample.
A Boolean value that states whether to insert a barrier before taking the sample.
Inserting a barrier ensures that any work you encoded with this encoder is complete before the GPU samples the hardware counters. If you don't insert a barrier, the GPU can sample the counters concurrently with other commands encoded by this encoder. Using a barrier leads to more repeatable counter results but can negatively impact performance.
Regardless of whether you set a barrier, the GPU does not isolate the sampling from work encoded by other encoders.