Advertisement

Dx12 - timestamp queries

Started by December 02, 2017 12:30 AM
3 comments, last by hiya83 7 years, 2 months ago

Hi all,

Any idea what the mechanism is for timing commands in the GPU command buffer in DX12 now? In DX11 it was BeginDisjoint, End's, EndDisjoint, GetData's. But in DX12, I see I can place EndQuery with a timestamp type, and I also see GetTimestampFrequency to get the frequency, but how do I get the tick value for each of the timestamp EndQuery's? I see ResolveQueryData, but that places the data in a GPU buffer, am I supposed to call that and then copy the data over? If so what is the format of that data? Unfortunately, I have yet to see a sample for timestamp queries yet. 

Thanks!

Yep, you're totally on the right track. The ResolveQueryData takes data from the query heap, which can be in a hardware-dependent format, and puts it in a buffer, one which is probably CPU-accessible, in the canonical format. Once the resolve operation is complete, you can read the contents of the buffer to get your timestamps.

Resolve can handle data from multiple query heap entries, and the output is one UINT64 per resolved timestamp, just like D3D11's GetData.

Advertisement

If you would like to see a code example, you can look at my Profiler class: https://github.com/TheRealMJP/DeferredTexturing/blob/experimental/SampleFramework12/v1.01/Graphics/Profiler.cpp

Thanks for both your responses!

This topic is closed to new replies.

Advertisement