Tag Archives: dx10.1

Adding Direct3D 10.1 support to a D3D10 application

Since my graphics card (ATI Radeon 4870×2) supports Direct3D 10.1, I thought I might quickly add support for Direct3D 10.1 to my in progress D3D10 engine. Using MSDN docs and a slide from the 2008 GDC, I found it was really easy to add D3D10.1 support, since the device simply inherits from the D3D10 device, and since 10.1 simply adds features, you can use it selectively for some nice techniques and/or performance gains.

MSDN suggests that if you are going to be using the device a lot, and already have some place holding the D3D10 device, you keep a pointer to it, so I will assume you have such a class.

First you must create the Direct3D 10 device as you normally would, however you must use the D3DX10CreateDevice() method instead (see below), this is outlined in the SDK and multiple tutorials online. I may write up how to do this at a later point, however it is outside the scope of this little article.

Once the device has been successfully created, we can try and get a Direct3D 10.1 device from it. To do this, we will be using the following methods:

  • HRESULT D3DX10CreateDevice( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, ID3D10Device** ); [This will create the D3D10 device, and makes it easier to do so and then create the 10.1 device.]
  • HRESULT D3DX10GetFeatureLevel1( ID3D10Device*, ID3D10Device1** ); [This will create the 10.1 device.]

The second method will take the current D3D10 device and create a 10.1 device from that if possible.

After we have our D3D10 device using D3DX10CreateDevice(), we can then call D3DX10GetFeatureLevel1, passing in the pointer to the device we just created, and a pointer-to-the-pointer to our D3D 10.1 device. This method returns a HRESULT indicating if the operation was a success.

If so, we now have a D3D10.1 device we can use for the extra functionality. I personally also keep a BOOL inside my Graphics class to allow me to easily check if I have 10.1 support.

Now you can take advantage of the new features in Direct3D 10.1, and SM4.1!