Cg lerp() performance on Geforce FX 5600

Hello,

I started a thread on cgshaders.org about this issue and heard that I’m not the only one that noticed this.

The lerp function (which translates to an ADD and a MAD in arbfp1.0 assembly) significantly lowers performance on my Geforce FX 5600.

With the fragment program disabled I get anywhere from 300-330 fps while with the fragment program enabled it lowers to 70 fps with a single lerp and it goes down to 25 with 4 lerps (using 5 textures).

Does anyone know the reason why?

For reference (shader source code is there too), here’s a link to the other thread: http://www.cgshaders.org/forums/viewtopic.php?t=2244

Thanks for reading.

Just google for it – apparently, if reports are to believed, the NV30 line (on which I believe 5600 is based) isn’t as optimized for floating-point fragment programs as it is for fixed-point.

If you’re using GC, try compiling for the nv30 profile, and using fixed variables rather than float or half.

[This message has been edited by jwatte (edited 11-19-2003).]

Thanks for the tip, that was definitely part of it. Could you post a link to where you found that?

I’m now getting from 50-70 fps which is much better than 25. There was no change switching to fixed point with the arb profile, while the fp30 definitely improved things.

However it’s a long fall from 300 to 70, are these operations really so costly?

Thanks for the help.

The great benefit of Cg is that it will handle target specifics like lack of fixed or half datatypes by automatically up-casting. You could produce a shader using fixed types optimised for the FP30 profile (Nvidia+OpenGL+NV30) and the same Cg shader can be compiled, unchanged, to ARB OpenGL or DX9 PS2 targets.

Got that from http://www.pocketmoon.com/Cg/Cg.html

Has some interesting information.