View Full Version : Questions about different shader languages

15-10-2005, 10:05 PM
Investigating about loading shaders, I found the basic one: pixel shader assembly. This is loaded using D3DXAssembleShaderFromFile. Ok! Now I have these silly questions:

1. I supposed there would be its counterpart, the vertex shader assembly, but haven't found it. Does it exists?

2. What I have found instead is high level vertex shader. But which function do I use to load it? Maybe it is D3DXCompileShaderFromFile, isn't it?

3. Is the same function, D3DXCompileShaderFromFile, used to load high level pixel shaders?

4. And I found there is a .fx file, that seems to be loaded with D3DXCreateEffectFromFileW... what kind of shader is that?

Thanks on advance!

16-10-2005, 02:20 PM
1. D3DXAssembleShaderFromFile - assembles any assembler coded shader
2. D3DXCompileShaderFromFile - compiles any (pixel or vertex) HLSL shaders to code.
3. -> (1), (2)
4. ".fx" files "effect" files encapsulate render states, pixel / vertex shaders in simgle "effect". Which can be: multipass; different render techniques for different hardware (for example one for GeForce3 with ps.1.1. and another for HW with PS.3.0. support)

18-10-2005, 02:52 AM
Thanks! I have another question: is it better to do all the transforms with vertex shaders, or in the old way, doing the transformations in the main programming language?

18-10-2005, 08:31 PM
If you do only transform and no fancy things when the "old HW T&L way" is always equal or better. Or by "in the main programming language" you meant transforming on CPU? Today you should definetly use GPU's for that.

18-10-2005, 09:35 PM
Interesting thanks! :D

19-10-2005, 03:41 PM
NVidia advices that developers should override the fixedfunction pipeline. it could possibly calculate a whole lot of crap like lighting and other stuff you maybe don't need.. well up to you. you're at least not going to lose anything on using shaders(unless you're a bad coder) ;)

19-10-2005, 07:15 PM
Well, if you are enabled lighting, and do not need strict behaviour / precision of "standart" lighting -> when you are somethat right.

But from the other side: fixed function T&L setup on modern chips translated to vertex shader, but it's often more optimized than it's possible by using standart vertex shader assembler syntax. You can verify it by youself looking at results of D3DRightmark - often used by www.digit-life.com, www.beyond3d.com and some other sites.