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.

I'm using PIX from the DirectX SDK to monitor my XNA application. I want to see the polygon count a model loaded in the application and was told this was information I could get from using PIX.

Problem is, I'm not sure how. I've looked through the documenation so maybe I'm just missing something obvious or maybe this is a feature I cannot use with my XNA application.

I could write code to get this information, but I was under the impression it would better practice to use a diagnostics tool instead of altering my code to retrieve the information.

Thanks.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

PIX is a fairly low-level data collector/analyzer for D3D. PIX can examine the state of device objects -- including vertex and index buffers -- from within an experiment. The PIX tutorials page has a document on examining mesh data. The tutorials tend to build on each other so it's probably a good idea to at least skim them from the first one.

It's not a bad idea to write code to compute this information for you though, and allow you to enable/disable it at will. This isn't really "polluting" you code in any way -- you can always configure this code to be compiled-out of release builds, and by having it in your program you can set it up so you can turn it on and off at run-time as well -- this way you may be able to enable it when you encounter a difficult-to-reproduce bug that warrants looking at this diagnostics data. If you rely only on external tools like PIX, you'd have to be able to ensure you can reproduce whatever bug or issue you're looking at before the tool will be useful.

Since you're using XNA, and not D3D directly, you may also find it a bit harder to correlate the D3D commands XNA sends with the XNA operations you're doing, since XNA is a higher-level API.

To compute your primitive count in code, you'll want to iterate all the ModelMesh objects inside your Model. Each ModelMesh has a collection of ModelMeshParts, which each have a PrimitiveCount. The sum of all PrimitiveCounts is the primitive count of the model.

share|improve this answer
    
okay. thanks. this was really useful. –  townsean Sep 13 '11 at 16:10

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.