Posts Tagged NVPerfHUD

Using PerfHUD with XNA games

If you want to use PerfHUD with an XNA game, you’ll need to make some changes to your source code. Since the PerfHUD documentation only explains how to do this when using the native DirectX interfaces from C++, it can be a bit confusing to figure out how to make it work with XNA, especially since the XNA Framework goes to some effort to prevent your games from starting on graphics devices that might not support its feature set (for example, reference rasterizers). Since PerfHUD presents itself as a reference rasterizer, you have to jump through some hoops.

The solution is to write a custom GraphicsDeviceManager that replaces the default XNA one. Luckily, you don’t have to write very much code to make this work – you just have to do things in a particular way so the framework remains happy. The source code can be found here. All you need to do is add this class to your project (or use the library it comes in), and modify your game’s initialization code to look something like this:

#if !XBOX
            Graphics = new PerfHUDDeviceManager(this);
#else
            Graphics = new GraphicsDeviceManager(this);
#endif

After this, you should be able to start your game under PerfHUD on Windows.

Please note that since the PerfHUD device presents itself as a reference rasterizer, I believe this disables use of some types of hardware acceleration within the framework, so your framerate may suffer as a result when running under PerfHUD, and you might get slightly misleading results when profiling. I consider this to be the unfortunate intersection of two bad design decisions, but not really a bug. If you felt so inclined you could probably work around this issue by hacking up the XNA Framework classes a bit so that they believe the PerfHUD device is a real hardware device.

Tags: , , ,

‘This application is not configured to use PerfHUD’ – how to fix it

For anyone trying to use NVPerfHud, if you get stuck trying to figure out this error message:

This application is not configured to use PerfHUD.

Consult the User’s Guide for more information.

You may have noticed that there is no reference to this error message, or ‘configuring your application’ in the User’s Guide. The solution is actually documented in the NVPerfHud Quick Tutorial‘, and involves changing the parameters you pass to CreateDevice.

Hopefully posting this here will help other people find this information, since googling the error message turned up zero results for me. Good work, NVidia!

P.S. Preventing ‘unauthorized profiling by third parties’? What the hell is this, the cold war? This is computer graphics, not espionage. Can you imagine if other software worked this way?

To prevent unauthorized pixel modification by third parties, any images you wish to view with Adobe Photoshop must contain a hand-written sample of dialogue from the second act of A Midsummer Night’s Dream, by William Shakespeare. Please note that dialogue from modern adaptations like the 1999 version featuring Kevin Kline is not sufficient. Also please note that handwriting in sufficiently obscure cursive scripts is unlikely to be recognized.

Tags: , , , ,

luminance is Digg proof thanks to caching by WP Super Cache