Using the Reference Rasterizer in XNA

Sometimes, there are subtle differences in the behavior of graphics cards from different vendors. These differences might be about how a specific setting is interpreted but much more often, the driver of one graphics card just allows some erroneous parameters while the other vendor's driver chokes on it.

In order to have a neutral reference against which drivers and applications can be tested, the DirectX team has implemented an entire modern graphics card in software. This is the so-called "reference rasterizer".

You can use the reference rasterizer in several ways:

  • You can run your XNA application on a system that doesn't have a shader-capable graphics card installed. The rendering will be extremely slow, but if you just want to work on some graphics algorithms while traveling around with your notebook, this might come in handy.

  • Another useful property of the reference rasterizer is its extended parameter validation. If you absolutely want to make sure your game, editor or whatsoever runs error-free on graphics cards from different vendors and will not break with future drivers, let it run on the reference rasterizer at least once before shipping!

Enabling the Reference Rasterizer

First, you need to install the DirectX SDK. Earlier DirectX SDKs provided a system control panel entry to configure DirectX options, but this has now moved into the start menu. Look for the "DirectX Control Panel" entry in the DirectX SDK folder:

The DirectX Control Panel entry in the start menu

In the DirectX Control Panel, you'll find an option labelled "Enumerate Reference Rasterizer". Make sure this option is checked:

The checkbox in the DirectX Control Panel for enabling the Reference Rasterizer

Using the Reference Rasterizer

If you just want to get started, you can now download a ready-made XNA game template that runs using the reference rasterizer here: Empty XNA Game using the Reference Rasterizer.
Otherwise, read on ;)

Beta2 of the XNA framework made it rather easy to run your XNA projects on the reference rasterizer. In the final 1.0 release, XNA's GraphicsDeviceManager will only start up when there's a shader-capable graphics card installed - even if you wish to use the reference rasterizer.

To work around this problem, you need to use a custom GraphicsDeviceManager. You can download a suitable one from this site:
XNA ReferenceGraphicsDeviceManager Class

Add this class into your existing XNA game and replace the GraphicsDeviceManager that's created in your Game class with our custom ReferenceGraphicsDeviceManager!