HLSL or Cg - Which is better?
category: general [glöplog]
Can someone comment on the differences between HLSL and Cg? Which are used more often in demos, and why?
use ASM.
is de musicdisk al af? :P
trc: you know you're going into the old "d3d vs ogl" discussion again, dont you :D
OH NOES! I don't want to go there..
I want to focus on D3D only. Or is HLSL/Cg strictly OGL?
I want to focus on D3D only. Or is HLSL/Cg strictly OGL?
what are the differences between C64 basic and C16 basic?
bonus question: which is used more often in demos, and why?
bonus question: which is used more often in demos, and why?
HLSL = DirectX, GLSL = OpenGL, Cg = nVidia. Choose GLSL if you don't want to limit yourself to one OS or vendor.
Answer: There is very little difference.
Commodore _bought_ an early version of Microsoft Basic from Bill Gates. Bill made a mistake by not licensing Basic. By licensing, he would have made a fortune. While Microsoft upgraded its Basic, Commodore refused to go back to Microsoft for a newer version because, by this time, Bill had realized his mistake and would have asked far more $$$. Therefore, Commodore had to upgrade the software themselves and they didn't think a good Basic was worth the extra effort. Therefore, if you want to do anything useful with a C64, you have to POKE yourself to death.
In conclusion, neither Basic is used in demos as assembler is much more efficient.
Now, back to the question at hand: HLSL or Cg?
Commodore _bought_ an early version of Microsoft Basic from Bill Gates. Bill made a mistake by not licensing Basic. By licensing, he would have made a fortune. While Microsoft upgraded its Basic, Commodore refused to go back to Microsoft for a newer version because, by this time, Bill had realized his mistake and would have asked far more $$$. Therefore, Commodore had to upgrade the software themselves and they didn't think a good Basic was worth the extra effort. Therefore, if you want to do anything useful with a C64, you have to POKE yourself to death.
In conclusion, neither Basic is used in demos as assembler is much more efficient.
Now, back to the question at hand: HLSL or Cg?
XTr1m: thanks! that's helpful.
for D3D i use HLSL. that way no extra tools and such to use.
what xTr1m said
Quote:
Now, back to the question at hand: HLSL or Cg?
Quote:
Answer: There is very little difference.
HLSL and Cg are exactly the same thing.
The only significant difference from what I remember is that the Cg compiler is slightly more strict, for example it won't let you imply that a float is actually a float4 with the same value in .xyzw or something like that, you will have to avoid ambiguous syntax.
And like Blackpawn said, if you're to use DX only, stick to HLSL, that's less extra tools in the chain (= less potential errors or issues)
The only significant difference from what I remember is that the Cg compiler is slightly more strict, for example it won't let you imply that a float is actually a float4 with the same value in .xyzw or something like that, you will have to avoid ambiguous syntax.
And like Blackpawn said, if you're to use DX only, stick to HLSL, that's less extra tools in the chain (= less potential errors or issues)
maar... is je musicdisk al af dan?
Keops i've encountered a number of differences between the two but yeah these can all be traced back to more strictness in the cg compiler. For example if you have a float x and write x/5: in hlsl it's interpreted as a float division, but in cg it's an int division. (Unless you write x/5.0f)
Also, if you have a float4, hlsl lets you access the values like an array even with another variable, like x[y]=0. In cg this did not compile.
Also, if you have a float4, hlsl lets you access the values like an array even with another variable, like x[y]=0. In cg this did not compile.
in my experience cg's compiler does a worse job of optimising than hlsl's, and it's quite a bit slower too.
Step into a time machine and step out of it as soon as Open CL killed everything else.
Smash: oh... so that's why my shaders seem to be less fast on PS3 than on 360 ;)
What about GLSL?
...don't you like it? :(
...don't you like it? :(
Who cares about OpenGL ?
zernobyl/wiz, don't go there..
Although it's funny how the cg compiler is considered more strict, considering how sloppy nvidias cgc-based glsl compiler is.
Although it's funny how the cg compiler is considered more strict, considering how sloppy nvidias cgc-based glsl compiler is.
I was thinking the same. I'm sure nvidia's sloppy glsl compiler is responsible for half of the 'nvidia only' demos, yet their CG compiler is really strict?!
keops: no comment :)
I do suck at optimising.
Quote:
I'm sure nvidia's sloppy glsl compiler is responsible for half of the 'nvidia only' demos
I'm pretty sure it has nothing to do with nvidia, and everything with the braindead ati opengl drivers. Tell me for example, why on bloody earth would a radeon x1600, with ps3 and everything, run a ~10 line shader in software which even the *friggin gma950* can run in hardware?