Using both D3D9 and D3D11

Started by
12 comments, last by Burnt_Fyr 10 years, 7 months ago


If I were to use this method, I would need to build two versions of my DLL, one for D3D9 and D3D11. Additionally, I would need two versions of my executable, correct?

You need zero DLLs. You can statically link the rendering code instead of dynamically linking it.

You'd probably also want three executables: The main one is the "Launcher" that probably has an options menu and a launch game button. The launch game button kicks off one of the other two exes (D3D9 or D3D11) depending on the settings and what the PC supports.

Advertisement

Couldn't you just set the D3D9/D3D11 dlls to be delay loaded in your project settings? Then they will only be loaded when your application first tries to use a function from one of them.

You'd still have to check for their existence before initializing your renderer or it'll crash when it tries to use one if it doesn't exist.

(Note I've never actually tried this with the D3D dlls, but I don't see why it wouldn't work)


For example, if the dev wanted to run their application on Windows XP, they couldn't use the Direct3D 11 runtime because it won't work on XP.
That's a big IF about now.

Personally, most computers I've dealt with still running XP had at least one problem which would make me run away screaming. I've fried an old XP machine, I've apparently loaded it too much causing... perhaps voltage regulators to blow up?

If you really want to run on XP, I strongly suggest to make sure everybody understands there's going to be no support involved. Personally I really don't want to have to deal with anyone still running XP.

Previously "Krohm"

You could design a system to load your renderer dynamically as a DLL. This way the DLL would be the only thing linking to the libraries in question, your host application/API would have the interface abstracted so it wouldn't care about the dependencies. So, for example, you can detect whether the user is running XP and force load the D3D 9 renderer DLL, or if they're not then load the D3D 11 renderer DLL.

I don't think I will want to use this because from what I've read, LoadLibrary and GetProcAddress don't really work well with C++ name mangling so I'll have to extern "C" a lot of things and I don't think that will work very well with namespaces. Although if I were to do this, what would be the best way to avoid rewriting declaration code (i.e. CreateDevice())? Should I just have a global header that doesn't belong to any specific visual studio project? Also, how would I load virtual functions from interfaces?

To see an example of this, look for the book 3d game engine programming by Stefan zerbst. You can look also look at the ZFX Community Engine which is based on the one presented in the book(sourceforge: https://github.com/kimkulling/zfxce2)

This topic is closed to new replies.

Advertisement