Sign in to follow this  
RealMarkP

HLSL or ID3DXEffect?

Recommended Posts

jpetrie    13103
In general, no.

In some cases you may be able to leverage finer control over the system to achieve some particular goal, typically on the asset production level, but in general you'll just end up reinventing large chunks of the Effect framework anyway, so you may as well use it until you find a pressing need for something it can't do.

Share this post


Link to post
Share on other sites
clb    2147
These two things are not mutually exclusive. You can use both at the same time, i.e. write .fx files that contain HLSL code.

If your question is whether to write shaders in ASM or HLSL, there's no doubt that HLSL is the way to go. Writing ASM from scratch is useless, only when optimizing might you want to take the ASM output of an existing HLSL code and tweak it a bit for a possible performance increase, but writing ASM all the way is just a waste of time.

Then, perhaps your question is that whether to use the D3DXEffect framework or not? Well, I'd suggest using it, as it is very quick to get things running with the effect framework and it does manage some of the stuff ready for you.

Naive use of the effects framework does lead to lots of redundant device state changes, but with careful use of shared parameter pools and switching between effects you can resolve most or all of them, depending on your use case. If you're not using D3DXEffect, you need to store & set all the shader constants, textures and other state using the appropriate D3DDevice functions by yourself, which requires a lot of design to do properly.

In my project I'm now working on dealing with the combinatorial shader explosion problem, which has lead me to abandon D3DXEffect, but it was a good friend to have during most of the development process. I don't consider it a wasted time since it let me focus developing other things instead.

Share this post


Link to post
Share on other sites
MJP    19754
I would very much recommend using the Effects framework. It's extremely robust, and it will say you huge amounts of time you'd need to spend implementing a lot of the features yourself.

You might want to have a look at this thread where wolf talks a but about his approach to organizing shaders using the FX framework.

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

Sign in to follow this