Skip to main content
GameDev.net gamedev.net
🔒 Locked

[DX Version] What is the "correct" way to detect the available version?

Started by thebjoern Nov 15, 2010 at 11:48 PM 5 replies 2.3k views
Original Post
thebjoern
thebjoern
Hi all,

I have created a simple application, which loads from a cfg file whether I want to use DX9, DX10, or DX11, and then proceed to load the dlls with the according functionality, which all works fine and renders fine.

Now I want to move on to determine which DX I can use, but I only know of using DSetup by calling DirectXSetupGetVersion() to find out. But it seems that is outdated? And I don't even have DSetup.dll on my machine (even though I had the .lib in my June 2010 SDK lib folder).

So what is the correct way of finding out, other than already loading a dll and trying to get the device of that version (ie CreateDevice), and if it fails, falling back to a lower version (which doesn't seem like a great way of doing it), until I get one working (or falling back to OpenGL, which I am supporting too)?

Thanks for your help,
Bjoern
MJP
MJP
D3D9 is easy: just require XP SP2 as the minimum and the core runtime will always be there. If you use D3DX, XInput, Xaudio, or any other optional libraries then you'll have to run the DX redist from your installer (located in the "Redist" folder of your SDK install directory, which is also where DSetup.dll is located btw. It's in the docs under "Installing DirectX with DirectSetup").

Don't bother with D3D10. There's no reason at all to use it, since D3D11 covers the same functionality and has the same OS requirements (Vista or Win7). It requires an update for Vista to be installed, but the SDK comes with an exe you can call from your installer that will handle that for you (see "Direct3D 11 Deployment for Game Developers" in the SDK docs). Then in your D3D11 path you check what feature level is available, and use the appropriate code path.
thebjoern
thebjoern
Hi Matt,

thanks for your quick reply.

Basically what I meant is that I have an exe, which then loads a dll with my code, depending on the setting in my config file (ie DX9/10/11/OpenGL). So in my dlls I just have different approaches on how I render the (simple) graphics that we require.

In that approach I was hoping not to make the user download/install DirectX (on the Vista/Win 7 we can already assume a minimum of DX10, and for XP we provide -if necessary- a link to install DX9c), and keep the installation as simple and straightforward as possible. [so the installer only checks on XP for the minimum requirement of DX9c, on the newer OS versions we don't check]

Therefore I was hoping that when I start my exe I can detect what's already available on the system (ie DX9c,DX10 or DX11), and accordingly load the appropriate dll of our code.

That's why I was trying to find out if there is a simple programmatical way of doing that, with some code that doesn't need to be specifically installed, but can somehow determine which version of DX the user has [and I am only using D3D, and D3DX, no XInput or XAudio or anything). So far I only saw that DirectXSetupGetVersion() which seems to be from DX9 times and not supported anymore?

Does that make sense what I am saying here?

cheers,
Bjoern

nlraley
nlraley
Yea, but don't let the installer worry you. It just requires a small handful of files for it to load the required files for the application to load and you can set it up to run quite in the background during your application's install if you are using any sort of installer. The user won't have to do anything extra on their end.
thebjoern
thebjoern
Ok, thanks for the information!

Nevertheless, I would still like to find out if there is an easy way of determining if I got DX11(10) or DX9 installed on the system - BEFORE loading any of the DX dlls? I don't even need an exact version of DX, just if its 9/10/11 running there so I know which of my dlls I have to load...

thanks,
Bjoern
Adam_42
Adam_42
Assuming the appropriate installers have been run, just check the Windows version with VerifyVersionInfo(). If it's Vista (6.0) or above then you can use DX10 and DX11.

DX9 and OpenGL should always be available.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.