PDA

View Full Version : GLSL == HLSL?



glfreak
07-26-2005, 12:52 AM
In HLSL there is the model 3 which supports reading the fragment screen position, is there any equivalent in GLSL?

How to compile GLSL program into assembly source like in DirectX FXC compiler?

What functionalities GLSL lacks of behind HLSL?

In the end I believe both should have the same caps and features since they all map to the same hardware and a driver capapble of support one API shlang, another driver is possible to support the other shlang, am I right?

And where is the vertex/fragment program vp2 specification, there's only vp1.0.

Thanks.

OneSadCookie
07-26-2005, 01:41 AM
gl_FragCoord according to my orange book.

It's not possible. GLSL isn't necessarily translated to assembler at all.

The two should be roughly equivalent; if ever one is ahead the other will not be far behind. I'd guess GLSL is slightly ahead at the moment.

In the end the card has the same features however you program it, though there is a small question of the quality of the compiler and possible card-specific extensions to GLSL.

There is no VP/FP 2 extension; the "assembly language" extensions are not likely to be developed further since GLSL is more capable.

V-man
07-26-2005, 01:24 PM
HLSL doesn't have shading models and neither does GLSL. HLSL is compiled by the D3DX library and there you can specify a shading model for the result because HLSL is compiled to low level shaders.
The low level object file(?) can be sent to D3D which passes it to the video driver which optimizes for itself. I think that's the gist of it.

In the GL world, we let the driver decide on the best low level format for itself. The driver can choose to expand loops, not expand, handle statements which the hw can't support directly in the way it chooses, etc.


What functionalities GLSL lacks of behind HLSL?I think functionally they are the same. Why do you assume it is lacking?


And where is the vertex/fragment program vp2 specification, there's only vp1.0. I donít think they will be updated.

If you have a nVidia, they expose their own extensions for the low level assembly.
You can also use Nvemulate to dump the assembly shaders to your applications folder when it compiles your GLSL code.

glfreak
07-26-2005, 04:57 PM
Thanks.

What about the 3DLabs compiler? is not supoposed to translate the glsl to some intermediate assembly code?

marco_dup1
07-27-2005, 12:21 AM
Originally posted by wismak:
Thanks.

What about the 3DLabs compiler? is not supoposed to translate the glsl to some intermediate assembly code?If you want assembler, the new Cg compiler compiles GLSL but you get AFAIK only output which is optimized for nvidia and rusn not so well an ATI cards. why do you want assembler? IP concerns? have you tried to obfuscate your code?

regards

marco