Sign in to follow this  
sipickles

Is D3DX undesirable?

Recommended Posts

sipickles    240
Hi, I was intrigued by the amount of code written by people which seems to replicate functions provided by the D3DX framework. I was wondering why this is...... Is bespoke, specialist code quicker, with the D3DX code meant as a helping hand for students of D3D? Or do the authors of directX do the quickest code? Your thoughts appreciated! Simon

Share this post


Link to post
Share on other sites
dave    2187
D3DX Code is mostly optimised highly. The reason people write their own code is usually because they are not aware of the D3DX equivelent, this is certainly the case for me.

ace

Share this post


Link to post
Share on other sites
sipickles    240
Yeah, i know what you mean, even in my limited experience....

You spend ages pondering a problem only to find that the function D3DXdowhateverbetter() exists!

Share this post


Link to post
Share on other sites
S1CA    1418
Another reason why some people don't use D3DX in the commercial world is due to cross platform development - for example PS2 doesn't have D3DX so most studios have developed their own "libraries of useful code" over the years.

I would still say it's beneficial to know how to implement each of the D3DX functions you use yourself - just so you understand what you're calling. For example I happily use D3DX functions for things like texture loading because they're as fast as I need and they save me from writing dull code that's already available, but I have written my own code to do the same in the past so I can write my own replacement if I need to port the code to a non-DirectX platform or if profiling shows D3DX to be a problem (very rarely has).

A big benefit of using D3DX is it's well tested (i.e. thousands of people developing with DirectX, hundreds beta testing it, millions of people using products that use D3DX).

Share this post


Link to post
Share on other sites
circlesoft    1178
Also, D3DX has implements some ground-breaking technology - for example, an entire pre-computed radiance transfer library. Additionally, D3DX has some really nifty mesh operations - but it's just a pain sometimes getting your data into an ID3DXMesh in order to use them. Microsoft pours a lot of resources into D3DX, making sure that it is up-to-date with the latest and greatest technology.

Like Simon stated, it's very important that you know what you are calling and what it does. The matrix and vector structures and functions are very optimize and quite useful - you just have to know how to use them first [smile]

On the subject of optimizations, here is a vintage D3DX thread. Have fun [wink]

Share this post


Link to post
Share on other sites
PlayfulPuppy    419
Personally I dont use it (For the cross-platformability reason stated earlier) but also because of the fact that D3DX has been put into an external DLL which, to the best of my knowledge, is not supposed to be re-distributed and therefore it requires users to go to the Microsoft site and download a new DLL, unless they have the SDK installed.

Needless to say, that's a bit of a pain. I dont know if this problem has been rectified yet, however, I haven't really been following it.

The other thing is that I'm not overly fond of using external libraries. I'm one of those 'Do everything yourself' guys, mainly because I know that if there's a problem anywhere I can go in and fix it, rather than having to work around it and possibly break compatibility with a different platform.

Share this post


Link to post
Share on other sites
Jiia    592
I'm not completely positive, but I think D3DX is linked at compile time. Regardless, I've had many non-developers run demos with no problems.

Share this post


Link to post
Share on other sites
Trip99    577
This issue came in with the February release that moves D3DX into a dll d3dx9_24.dll, then in April it is d3dx9_25.dll. It is only a pain for those who do not distribute the end user runtime with their apps. This applies to me because my stuff is generally downloaded and I assume the user has DirectX 9.0c on ther machines. Now they need DirectX9.0c + the correct D3DX dll. The simple solution is of course just to include the dll with your app however this is against the Microsoft license agreement...

Share this post


Link to post
Share on other sites
Pipo DeClown    804
Quote:
Original post by Trip99
This issue came in with the February release that moves D3DX into a dll d3dx9_24.dll, then in April it is d3dx9_25.dll. It is only a pain for those who do not distribute the end user runtime with their apps. This applies to me because my stuff is generally downloaded and I assume the user has DirectX 9.0c on ther machines. Now they need DirectX9.0c + the correct D3DX dll. The simple solution is of course just to include the dll with your app however this is against the Microsoft license agreement...


Agree, PITA.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
just use opengl...solves all your problems...

Share this post


Link to post
Share on other sites
Allmight    206
"just use opengl...solves all your problems..."

No it doesn't. OpenGL doesn't have something coresponding to D3DX at all. And it has it's own share of problems. You have to download stuff for OpenGL as well ( extensions for example ), so neither is better than the other. DirectX is very good at some things, while OpenGL at others.

To answer the first post. Many people write their own code just the learn what it is all about. I know i write most of the stuff that i could get from the D3DX libray. Not because i can do it better ( most of the time you cant ), but because i want to learn how it works.

// Allmight

Share this post


Link to post
Share on other sites
S1CA    1418
Quote:
Original post by Pipo DeClown
Quote:
Original post by Trip99
This issue came in with the February release that moves D3DX into a dll d3dx9_24.dll, then in April it is d3dx9_25.dll. It is only a pain for those who do not distribute the end user runtime with their apps. This applies to me because my stuff is generally downloaded and I assume the user has DirectX 9.0c on ther machines. Now they need DirectX9.0c + the correct D3DX dll. The simple solution is of course just to include the dll with your app however this is against the Microsoft license agreement...


Agree, PITA.



Chuck Walbourn from the DirectX/WGGT team commented about this exact issue on the DirectXDev list:

Quote:
You are expected to ship the REDIST with your application. There are directions in the latest SDK on how to cut out certain components to reduce the size of the REDIST (don't need DirectShow, don't need Windows 9x/ME support, don't need managed support, etc.). You currently must include at least the 2000/XP DirectX 9.0c files as part of the REDIST.

The next release of SDK (June) will support cutting out most everything except the D3DX .cab and DXSETUP.EXE/DirectXSetup will succeed if the system already has DirectX 9.0c runtimes installed. This should make it easier for downloadable applications.

If you happen to require an older D3DX dll, the REDIST supports installing older D3DX cabs as part of a newer REDIST (for cases where you might need both Feb D3DX and Apr D3DX or something like that).

Directions on all this can be found in the April SDK's C++ documentation under the topic "Installing DirectX with DirectSetup"

-Chuck Walbourn
SDE, Windows Gaming & Graphics



So, in summary:

1) with the currently available SDK, you can legally reduce the size of the redist quite a lot by removing components such as DirectShow and Managed support.

2) with the next SDK, you will be able to legally strip the redist down to just D3DX and the setup files. Panic over.

Share this post


Link to post
Share on other sites
Trip99    577
That sounds good but do you have any idea on the size of this reduced redist? I have a program that is about 2MB to download. If I add a redist which is a few meg itself I may start hitting my website bandwidth limit. I will need to do some experiments and see how much it reduces to.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Quote:
Original post by Trip99
That sounds good but do you have any idea on the size of this reduced redist? I have a program that is about 2MB to download. If I add a redist which is a few meg itself I may start hitting my website bandwidth limit. I will need to do some experiments and see how much it reduces to.


This is from another email on the DIRECTXDEV mailing list, sent out by Chuck Walbourn on 13th April:

Quote:
In any case, we are
on-track for a solution in the June release. The solution is going to
be through the existing DSetup API and you can test and release it with
the SDK you have available today, the resulting REDIST will just drop in
size from 16 Mbytes to less than 4 Mbytes if you can guarantee your user
already has DirectX 9.0c installed.


I'd still wait till the June update is out (should be sometime soon!), but provisionally it looks like 4 Mbytes is the estimate.

hth
Jack

Share this post


Link to post
Share on other sites
S1CA    1418
Quote:
Original post by jollyjeffers
I'd still wait till the June update is out (should be sometime soon!), but provisionally it looks like 4 Mbytes is the estimate.


BTW: I think that 4MB is the *uncompressed* estimate. Looking at the Redist folder in the April SDK seems to confirm this:

Apr2005_d3dx9_25_x64.cab (1317 KB),
Apr2005_d3dx9_25_x86.cab (1055 KB)
[Total: 2372 KB]

Looking inside the _x64 CAB, the uncompressed total size for the files is 3801 KB, and looking inside the _x86 CAB, the uncompressed total size is 2295 KB.

Share this post


Link to post
Share on other sites
Trip99    577
Well that may be ok. I wonder what else is making it 4MB as the d3dx dlls are not that big (d3dx9_25.dll is 2.22MB uncompressed). If this is for people with DirectX 9.0c already then you would think all they would need is the dll. Of course the dll in the next release may be bigger.

Share this post


Link to post
Share on other sites
paulble    349
Quote:
Original post by Trip99
Well that may be ok. I wonder what else is making it 4MB as the d3dx dlls are not that big (d3dx9_25.dll is 2.22MB uncompressed). If this is for people with DirectX 9.0c already then you would think all they would need is the dll. Of course the dll in the next release may be bigger.


The extra overhead is that you still need to ship our dxsetup.exe, dxsetup16.dll, dxsetup.dll, and dxupdate.cab files in order to install anything.

(And, yes, before anyone asks, we're looking at ways to reduce the size of those too... ;)

Paul

Share this post


Link to post
Share on other sites
reltham    642
It would be really nice if there was a single exe that you could distribute and run that would just install the D3DX DLL as needed.

I think it would be fine if this was simply just a self extracter that had the above mentioned files and did the needed stuff. I assume there is an option to do a silent install that just puts the DLL in place?

I'd just like as simple a solution as possible to patch this to our installed base (MMORPG). They will all be already running Dx9c and we just want to get the D3DX DLL to them in a legal way that is transparent for them.

Share this post


Link to post
Share on other sites
paulble    349
Quote:
Original post by reltham
It would be really nice if there was a single exe that you could distribute and run that would just install the D3DX DLL as needed.

I think it would be fine if this was simply just a self extracter that had the above mentioned files and did the needed stuff. I assume there is an option to do a silent install that just puts the DLL in place?

I'd just like as simple a solution as possible to patch this to our installed base (MMORPG). They will all be already running Dx9c and we just want to get the D3DX DLL to them in a legal way that is transparent for them.


One can build such a solution with the provided files. It seems questionable what value we could provide in providing a self-extracting exe of those files. Given that your likely providing other files with the patch, it seems odd to archive up the d3dx redist stuff and then archive that up with the other patch files, no?

While we are investigating other redist options, it is unlikely that one will ever see anything that treats d3dx specially.

Paul


Share this post


Link to post
Share on other sites
Halsafar    205
I do not even feel like I need to read a single post... although I did skim the first few.


D3DX is beautiful, a nice use when you are at a complete loss but I find 2 big problems with it:

- You should never use something if you do not understand at least how it works even at a basic level.
- No longer does D3DX compile static, it is dynamically linked, so for some people they will need your D3D9X_DLL or be forced to update since you cannot distro just that file without the whole 30mb distro. Annoying.


I am trying to and always have been to replace every instance of a D3DX function I can. Faster or not, at least my knowledge is highly developed.

Share this post


Link to post
Share on other sites
LarsMiddendorf    122
Is it possible to share a vertexbuffer between multiple D3DXMesh and to let the mesh use the baseindex when drawing ? If not, I think that you can't use the mesh class then, because it could be slower than your own solution.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Quote:
Original post by LarsMiddendorf
Is it possible to share a vertexbuffer between multiple D3DXMesh and to let the mesh use the baseindex when drawing ? If not, I think that you can't use the mesh class then, because it could be slower than your own solution.

That is a valid point, but it's worth baring in mind that it's rare that one size fits all. ID3DXMesh (and associated technologies) is probably good for the majority of uses, but it aint perfect!

For our engine I dropped all of the D3DX/D3D text rendering stuff as I could get about a 12x (~50fps -> ~1200fps) speed increase from taking advantage that I knew the domain in which it was being used and could customize/optimize to take advantage of this...

Jack

Share this post


Link to post
Share on other sites
d000hg    1199
Quote:
Original post by Halsafar
I do not even feel like I need to read a single post... although I did skim the first few.


D3DX is beautiful, a nice use when you are at a complete loss but I find 2 big problems with it:

- You should never use something if you do not understand at least how it works even at a basic level.
- No longer does D3DX compile static, it is dynamically linked, so for some people they will need your D3D9X_DLL or be forced to update since you cannot distro just that file without the whole 30mb distro. Annoying.


I am trying to and always have been to replace every instance of a D3DX function I can. Faster or not, at least my knowledge is highly developed.
Knowing how everyhting works is maybe desirable, but certainly not a necessity. For instance at work we've licensed a product to send SMS text messages. We have no interest in knowing how it does this. Similarly at my last job, the physics engine we used was Mathengine. I don't think many people knew much about collision detection at all; whether even the lead physics guy understood the special matrices it used to optimise PS2 performance is doubtable.
You wouldn't try to re-write the Windows functionality for dialogs etc. And why is it different to do your own versions of D3DX functions, but not the D3D ones? Do you plan to write your own interface to the hardware - I think not.

Share this post


Link to post
Share on other sites
superpig    1825
Quote:
Original post by Halsafar
I do not even feel like I need to read a single post...
And yet you should have done, because if you had you would have realised that your second point is invalid. Please stop propagating misleading information.

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