Cg vs GLSL

Started by
13 comments, last by noVum 19 years, 1 month ago
yes they are supported and widely used, but they wont be getting any upgrades, thats the problem with them.
If you are using Cg to target NV cards then you dont have a problem, NV release new extensions to take advantage of new hardware features, but ATI are going the GLSL route and as such that will be where all the benfit comes from.
(for example, i'm pretty certain that the ARB extension cant perform texture reads in vertex programs, NV's extensions can and so can the GLSL, so already we are seeing a gap developing).
Advertisement
What about dynamic branching? If cg shaders on nvidia cards compile down to ARB fp/vp how do they handle conditions?

thanks
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
Always avoid if/else statements in shaders. They will dramatically reduce performance. That's my experience.
You can always use the arb profiles with Cg and generate ARB_fragment_program or ARB_vertex_program code. Checking nVidia's site I found out that you can use MRT with the arb profiles. I don't know about branching and vertex shader texture sampling, and I don't really care, as I'm using GLSL as well.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
Quote:Always avoid if/else statements in shaders. They will dramatically reduce performance. That's my experience.
Static branching won't. And that's a very helpfull feature for shader management :)

This topic is closed to new replies.

Advertisement