Jump to content
  • Advertisement
Sign in to follow this  
RonHiler

[DX9] Effect files without D3DX

This topic is 2945 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know this is going to sound strange and people are going to say "why are you doing that?". Just take it as a given that I want to keep the dependencies to a minimum, and I want to keep D3DX out of my project. So far (for DX10, 10.1 and 11) I haven't needed it at all (I have perfectly good Matrix and Vector classes in my engine already, and up until now, there is nothing else in there I need or can do by other means).

In DX10+, dealing with loading/reading effect files seem to be integrated into the main API, I'm using D3D10CreateEffectFromMemory() to create my effects just fine.

However, in DX9, effects seem to be relegated strictly to the D3DX library. This is a bit problematic, as I'm not entirely sure where to go from there (EVERYTHING I can find on the web or in any reference I have assumes the use of D3DXCreateEffectFromFile()).

I can load the fxo file manually and put it into a memory block (my engine's verson of the heap), no problem there. But then what? How do I get my pixel shader, vertex shader, passes, and techniques all set up? I'm looking for something along the equivalent lines of D3D10CreateEffectFromMemory(). There doesn't appear to be anything in DX9 similar to ID3D10Effect.

Any pushes in the right direction would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
In DX9 effects were entirely part of D3DX. The core API can handle raw pixel shaders and raw vertex shaders, but that's it. It has no ability to compile, parse, manipulate, or do anything else with an effect. You'll have to use D3DX if you want any of that functionality.

Share this post


Link to post
Share on other sites
How very unfortunate. That's kind of the same conclusion I was coming to myself after scouring the docs.

Okay, so I'm probably (for now) going to cave and add in the D3DX9 library for that functionality.

But just for the sake of argument, if I wanted to support a technique in DX9, I would have to parse the fxo file myself for the technique and sort out the passes, pixel, and vertex shaders myself, presumably through some sort of an effect class. I presume the fxo files are no longer text files, which would make parsing them that much more "interesting".

I don't suppose the source code for D3DX9 is available anywhere for me to take a look at, is it?

Share this post


Link to post
Share on other sites
There's no source code for D3DX9. There's source code for Effects11 in the SDK, but I have no idea what's changed in between the two versions (probably quite a bit). Still might give you some clues as to what's in the binary format.

Otherwise you might just want to use fxc to compile all of the shaders in an effect, and then just load those.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!