2
$\begingroup$

Does anyone happen to know the latency difference between copying a texture on cpu (using, say, memcpy) compared to gpu (using, say, CopyResource)? I would do a perf test myself, but I'm not actually sure how to do the trace for the CopyResource. A rule of thumb would be fine, it doesn't have to be exact, I just figure that the GPU is faster than the cpu for this but am just curious how expensive a copy of, say, a 1920x1080 texture is.

$\endgroup$
  • 1
    $\begingroup$ do you mean copy from RAM to RAM vs. copy from VRAM to VRAM? $\endgroup$ – Kyy13 Nov 20 '19 at 20:06
0
$\begingroup$

You can use Query for mesuring time on GPU. Idea is follow: Create buffer with two int64 values. Write time stamp before and after CopyResource() on GPU to this buffer. Then retrive values on CPU and substract them. Substraction is time on GPU.

| improve this answer | |
$\endgroup$
0
$\begingroup$

For anyone wondering how to deal with it, please refer to mjp (Matt Pettineo) github - https://github.com/TheRealMJP/DXRPathTracer/blob/master/SampleFramework12/v1.02/Graphics/Profiler.cpp

MJP's code is DX12. For DX11, you can refer to my github - https://github.com/komilll/dxFramework/blob/master/dxFramework/Profiler.cpp

In both DX11 and DX12, you basically just creates timestamps at the beginning and at the end of some portion of code. Then you have to resolve it, based on GPU speed. GPU might work with different clock frequency based on current workload. When you have a full PBR engine with shadow or SSAO, you should already have no problem with changing clock. However, if you're just starting creating your engine/framework, keep in mind that time to execute might not be precise, because you're not using full GPU power.

In DX12 there is ID3D12Device::SetStablePowerState but I've seen multiple times that people are recommending not to use it. Maybe there are some use cases, but for typical hobby usage, I won't bother with that.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.