Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

To measure CPU code, I use a Stopwatch. Using a Stopwatch in the Draw method is meaningless for the GPU side of things since the CPU and the GPU run asynchronously.

The questions is simple: Is it possible to measure the total time spent on a chunk of HLSL code? Perhaps as granular as the technique/pass.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You seem to be using DirectX, so you can probably use the techniques described in this article. It explains how to use ID3D11Query objects to profile GPU code.

Since you're in managed code, you might have to use some clever P/Invoke to get to that API if SharpDX doesn't expose the functions itself, although it seems like it does.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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