Frame Statistics

Started by
2 comments, last by BenS1 11 years, 6 months ago
I know DirectX provides some basic profiling capabilities as explained in here:

http://mynameismjp.wordpress.com/2011/10/13/profiling-in-dx11-with-queries/

However, I was wondering if there was actually a way to access more detailed stats, such as:

  • the total number of triangles drawn,
  • the total number of texels rendered
  • Percentage overdraw (Texels that are drawn and then subsequently drawn over again)
  • Total number of Vertices passed through the vertex shaders
  • Total number of Pixels passed through the pixel shader
  • etc.

I suspect the answer is that its either not possible, or that the information is available but only through hardware specific utilities or APIs.

Thanks
Ben
Advertisement
Ah ha, I may have found the answer.

It looks like you can perform a D3D11_QUERY_PIPELINE_STATISTICS query, which returns a D3D11_QUERY_DATA_PIPELINE_STATISTICS structure, as shown here:

typedef struct D3D11_QUERY_DATA_PIPELINE_STATISTICS {
UINT64 IAVertices;
UINT64 IAPrimitives;
UINT64 VSInvocations;
UINT64 GSInvocations;
UINT64 GSPrimitives;
UINT64 CInvocations;
UINT64 CPrimitives;
UINT64 PSInvocations;
UINT64 HSInvocations;
UINT64 DSInvocations;
UINT64 CSInvocations;
} D3D11_QUERY_DATA_PIPELINE_STATISTICS;


Each member being a count of the number of times that part of the pipeline was invoked.

So that seems to give me much of what I'm after. i.e. the raw counts, but not the amount of overdraw etc.

Thanks
Ben
Don't you just hate it when you ask a question and find the answer just minutes later? Used to happen to me all the time, haha.

I think you can work out the amount of overdraw by looking at the number of pixel shader invocations (PSInvocations), if it's close to the number of pixels in your render target that were covered by geometry (hopefully all of them) then overdraw is about 0%, if it's much greater then you get more overdraw... Another method but which is only really useful for debugging is to maintain an overdraw buffer which you increment each pixel by one when its pixel shader gets invoked, this'll give you the exact number of pixel shader invocations per pixel and you can investigate overdraw issues. Though there's probably a better way to do this.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Thanks Bacterius, you're right it'd be relatively simple to jsut compare the number of Pixel Shader invocations to the number of pixels on the screen to check for overdraw.

I also like your idea of an overdraw buffer for debugging\performance analysis. I'll have a think about that some more.

Thanks
Ben

This topic is closed to new replies.

Advertisement