PDA

View Full Version : Cg and Sh



Jesse M
04-26-2005, 02:17 PM
I've been learning Cg for awhile now and I've just heard about Sh. After browsing the Sh page for awhile I got a little more curious about it.

I was wondering if there is any performance differences between Cg and Sh. Are there Cg vs Sh documents to read?

N64Marin
04-26-2005, 05:44 PM
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.

SirKnight
04-26-2005, 05:55 PM
What is Sh? Is it OpenGL Shading Language?
No Sh is not GLSL. You can check it out here: http://libsh.org/

As far as speed...I really don't know but I'm sure there's not any significant difference.

-SirKnight

Jesse M
04-27-2005, 08:21 AM
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.

SirKnight
04-27-2005, 11:48 AM
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. :)

-SirKnight

Jcl
04-28-2005, 12:54 AM
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...

... and I've had no ATI cards in the meanwhile ;)

knackered
04-28-2005, 03:13 AM
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.

T101
04-28-2005, 03:37 AM
Well, I suppose it shaves about a minute of compile time from your development/testcycle.

Which is always nice if you just want to fix that one compiler error you receive when you run your program and try to use that shader.