What is Sh? Is it OpenGL Shading Language? I’ll tell you on nVidia cards, GLSL and Cg is compiled by the same compiler, no speed differences. On ATI cards, I haven’t tested, but it seems ATI may optimize the GLSL compiler and perform better than Cg IN THE FUTURE, but the ATI GLSL compiler has a lot of bugs currently.
Then I’ll stick with Cg. The Sh method of embedding compiled code right inside your C++ program sounds cool, but at the same speed I would rather load a script that I can edit with recompling my whold program.
Yeah I agree, being able to modify a shader while the program is running and see instant results is quite cool. And since there is no way Sh could be faster, Cg is the way to go if run-time shader modifying is what you are after. I’m not trying to say Sh is bad, it’s quite good and capable but I’m also going to stick with Cg & GLSL.
So is Cg supported on ATI already? I thought they were going to support only GLSL… but to be honest, I’ve been disconencted from the shader world (other than old fragment programs) since Cg and stuff started popping out…
I’m not entirely sure I see the advantage to being able to modify shader scripts at runtime…I used to think it would be useful, but in practice the modification of the script usually goes hand in hand with a modification in the code using the script, so it seems a bit pointless.
If you need the ability to modify at runtime, just wrap your shaders in a DLL.