mikew

DirectX9

5 posts in this topic

I'm trying to compile an open source Glide wrapper using Visual Studio 2015 Community Edition, but I seem to be lacking the library d3dx9.h.

Since TFXplorer also uses DX9, I assumed that the the SDK is now included since that builds OK...but the code doesn't look for that library as far as I can see.

So, the best case scenario is that all the DX9 functions are still there, but the include file is named differently.
I don't want to install the old SDK (from 2010) on this PC for various reasons, but I suspect a legacy DX9 project would needs a complete rewrite to use the default VS2015 install. :(

Anybody here have knowledge of such things?

Share this post


Link to post
Share on other sites

D3DX9 is Direct3D 9 extensions. It’s a helper library for vector math, texture loading, and other things. (Much like GLUT for OpenGL.)

The library has been deprecated a long time ago. MS stopped shipping it with D3D 10 and they cut the 9 version from the Windows SDK (which ships with Visual Studio) some time around 2010 (to the outrage of many developers).

The only way to get it is via installing an old DirectX SDK (June 2010 is the best version for a couple of reasons). If you don’t want to do that, you’re basically screwed. Even if you find the header file and provide it, you’ll be missing the library file. If you provide it, users can’t run the program because D3DX9.DLL will be missing.

TFXplorer relies on its own helper functions and does not use D3DX, that’s why it still compiles. (It was the exact mess with D3DX that taught me to use as few Microsoft libraries as possible.)

Projects don’t need a complete rewrite, but they’ll need to replace D3D extensions with their own code. This is likely a major project (even more for D3D9, because there are no direct replacements in newer libraries), but we can estimate the amount of work:

  1. Hit CTRL+SHIFT+F to open "Find in Files"
  2. type D3DX
  3. uncheck "match whole word"
  4. Find

You will see what D3DX functions are called by the code.

  • If it’s just D3DXCompile, we can probably get it working with Visual Studio 2015 very quickly. (VS can compile shaders on its own.)
  • If it’s using many vector and matrix functions, they need to be replaced with some kind of math library. This will be a hassle and take long time.
  • If it’s using even more functions for sprites, texture loading, mesh optimization – we’re pretty much screwed.

I hope this helps …

Share this post


Link to post
Share on other sites

Great! This isn't the slightest bit important, but it's interesting to see how you would tackle this....ie not getting into this situation in the first place. :)

Using your search method, I see that there's only a couple of functions being called, 'D3DXAssembleShader' and 'D3DXLoadSurfaceFromMemory',so it may be possible to replace them given some motivation.

I suppose Microsoft can be forgiven for this one since the capability of graphics cards has moved on considerably since DX9 came out.

Share this post


Link to post
Share on other sites

It had nothing to do with GPU capability – all of D3DX were CPU functions which called regular D3D APIs. It was just a high-level wrapper over the D3D (“load this texture” instead of “create texture object, map it, copy data from here, unmap it, generate mip levels”).

I don’t know the reason why they did it, but I suspect very bad motivations.

The amount of code that Microsoft destroyed 2005–2015 was incredible. Not just with D3DX, but also with XNA – the C# framework that powered many actual PC/XBox games, which was abandoned just like that. And DirectPlay, the DirectX network API. The various XBox APIs that were abandoned. And so on.

All these engines, all these games – their sources became useless in the fraction of a second.

I personally rely on

  1. the D3D 9 core being supported for two or three more years (mobile devices have been fully D3D 11 compatible for years now, with much better performance with 11 than with 9)
  2. D3D 11 being supported for five to ten more years (they explicitly stated that D3D 12 is no replacement, but a low-level alternative)
  3. only C/C++ (I bet WPF and WinRT will be abandoned next)

[end of MS rant :) ]

Share this post


Link to post
Share on other sites

I'd forgotten those heinous crimes, so rant away!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now