Sign in to follow this  
Racky1275

Writing future proof DX9 code (without T&L)

Recommended Posts

With all the fixed-function transformation and lighting gone with the introduction of DX10, would it be a good idea to write any new DX9 code without them too? I would guess that it would probably make any future porting to DX10 a lot easier. I'm assuming that the vertex and pixel shaders of DX9 are up to the task, as they can definately be used for per-pixel lighting. My worry is that performance under DX9 would be seriously degraded. The balance of vertex vs pixel shaders may make this more of a problem for DX9 hardware that with DX10. Thoughts anyone?

Share this post


Link to post
Share on other sites
All functionality in the fixed-function pipeline can be easily done with vertex and pixel shaders. (I believe current drivers even implement the FFP by using built-in shaders).

There's no need to worry about a performance drop. The fixed-function pipeline is not specifically faster than a well-written shader.

Share this post


Link to post
Share on other sites
Hmmm, interesting...

I wonder if you even get a speed boost when using pure DX10 class hardware?

When I get a chance I'll take a look through some DX10 examples and see if the shader code can be back-ported to DX9. I doubt it, there's a lot of new commands.

Share this post


Link to post
Share on other sites
If you don't use the geometry shader, DX10 shaders are much like DX9 shaders, just with more of everything. Of course there are a lot of other changes, for example constant buffers or texture arrays, but you won't rely on them right from the beginning so your shaders should be portable easily.

Share this post


Link to post
Share on other sites
There shouldn't be any problem with dropping fixed-function these days. The question is more a case of whether you include/exclude SM1 support - there are still lots of crappy GPU's (low end desktops and laptops being good examples) in the market.

Going for an entirely FX-driven architecture is a good move with D3D9 as it will definitely help you going forwards to D3D10 and it is also capable of handling every hardware version - Fixed Func, SM1, SM2, SM3 and SM4. Write some good application-side code and you're pretty much independent of how you actually implement individual effects.

As others have said, don't worry about performance - if it proves to be a problem there are lots and lots of tools, resources and archived discussions on how to improve things.

The non-unified architecture prior to R600 and G80 can be a bit of a bugger to balance optimally, but you can get the same problem with older FF anyway.

Quote:
DX10 shaders are much like DX9 shaders, just with more of everything.
I concur. For most practical cases using D3D9+SM3 is going to get you the vast majority of the features that D3D10+SM4 will.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
The question is more a case of whether you include/exclude SM1 support - there are still lots of crappy GPU's (low end desktops and laptops being good examples) in the market.

Note that the current DirectX SDK does not support SM 1.0 anymore, so you would have to develop with a DirectX SDK before June 2007 than.

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