NVidia Cg Philosophical Question

Hi all, I am writing an OpenGL-only based program, that is, no DirectX support is planned, and I was considering to support Nvidia’s Cg language, so before I start coding I would like to ask the following questions:

  • Is Cg capable of generating GLSL code or is just a myth?

  • Do ATI cards support the necessary extensions to run the assembly code generated by Cg for shader model 3 and shader model 4? If yes, are there any performance or stability issues?

  • Since my application already supports the latest GLSL extensions, including geometry shaders, is it worth to also support Cg?



  • Cg can generate GLSL code using the right profiles
  • ATi drivers do not support the newer assembler extensions just the basic ARB program stuff, so with an ATi card your only option is to use the GLSL profiles

In my opinion if you just use OpenGL its better to use GLSL. Given new hardware shows up with new features you can use them faster with GLSL as Cg might be updated later. With the G80 hardware it took some time for Cg to support the latest features while they were exposed for GLSL via extensions right at the start.

Thanks Chris,
after a bit of research it seems also to me that in my case Cg wouldn’t bring any particular benefit. Also because it seems that the GLSL profile supports only OpenGL 2.0’s GLSL and not 2.1’s, is that true?

The only real benefit of using Cg in my case seems to be the fact that Cg is used in the playstation 3 in conjuction with a particular implementation of OpenGL ES 2.0 (in wich GLSL is missing and Cg is used instead of it).

Since my application supports also OpenGL ES 2.0 adding Cg support to it would make it (potentially) compatible with the playstation 3 but I heard contrary opinions with regard to the PS3’s OpenGL driver quality and have been told that very few people are actually using it.
Does anyone have have any info to share about this point?