Today I downloaded Nvidia Nsight in order to profe my game GPU side and I came across some doubts:

  • I can't find only any resource of what are the average times for the different DirectX functions (such as map/unmap, clear the target view, draw (even if is strongly dependant on shader and similar my are really basic), ...) and so I can't know if my values are normal or not. For example for the map function (with write_discard) I've got an average of 0.8-1 microseconds.

  • There are always peaks in each function: map() for example goes up to 200 microseconds (randomly and rarely).

Here's a screenshot:


Is it normal?

  • \$\begingroup\$ Time the call your self, you can wrap every call you make to the API and return the gpu time for that call. msdn.microsoft.com/en-us/library/windows/desktop/… I know that to build my instance buffer using Map\unmap it can take from 0.05ms to 0.1ms, I use sharpDX so I get a 2.5x perf hit I think \$\endgroup\$ – Justin William Stanley Bryant Apr 26 '17 at 12:03
  • \$\begingroup\$ @JustinWilliamStanleyBryant so my times are totally fine. Aren't they? \$\endgroup\$ – Liuka Apr 26 '17 at 15:41
  • 1
    \$\begingroup\$ From what I understand, they are fine. I don't want to make an answer because I'm not 100% but your timings seem good. \$\endgroup\$ – Justin William Stanley Bryant Apr 27 '17 at 1:21

You're unlikely to find comprehensive resources on what the "average time" for D3D calls is. Any given D3D call is generally going to involve three things that seriously impact performance:

  • the front-end part of the function, implemented in the D3D library
  • the back-end part of the function, implemented by the driver
  • the algorithm used by the function, impacted by the data you give it

Only that first aspect is likely to be fixed broadly enough to collect "average" timings, but the impact of the other two aspects would likely overwhelm the first anyway. So "average" timings aren't very useful.

If your game is running acceptably, you shouldn't worry about those profiling numbers. They're "fine." If your game isn't, it may be worth investigating more deeply why you get those spikes or whatever. But there isn't enough information present in your question to provide much further guidance.

  • \$\begingroup\$ Thanks for the answer, but being honest I don't even remember where I found this issue :) \$\endgroup\$ – Liuka Oct 11 '18 at 17:19

It is also the matter how you call Map(), for example a MAP_WRITE_DISCARD can take more time than using MAP_NO_OVERWRITE because of their contracts. DISCARD will give you a new allocation, NO_OVERWRITE is saying that your allocation is safe to be written to, just get the pointer to it. Not only these can affect your performance, but how big and much data you actually copy into these mapped buffers. Your best bet is to profile them with a real CPU profiler or inserting some timers of your own.


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.