GLSL performance issues for uniforms passed as FloatBuffers

Hi,

I hava a palette shader implementation that uses a uniform to supply an array of 4x4 matrices. This all works fine but the cost of supplying matrices as a FloatBuffer is enormous.

I’ve done some investigative work and it seems that calling any glUniform… method (either ARB or GL 2.0) with FloatBuffers is > 50 times slower than using a non-FloatBuffer equivalent.

As an example calling
glUniform4fARB(int location, float v0, float v1, float v2, float v3)
is > 50 times faster then calling
glUniform4fvARB(int location, int count, FloatBuffer value) - (where the FloatBuffer has size 4)

This behaviour extends to all glUniform methods.

Data is always correctly supplied to the shader when using FloatBuffers.

Has anyone come across this kind of problem before?

Could it be Gfx driver related? (I’m running on an Nvidia GeForce Go 7900 GS on Windows)

Even if no-one can directly help it would be good to get confirmation that others can pass a vec4 as a FloatBuffer into a shader without this kind of performance drop-off. (Preferrably on an Nvidia card)

Are you sure you use a direct buffer?

This issue is being looked at here: http://lwjgl.org/forum/index.php/topic,2561.0.html

For info:

This turned out to be a driver issue.

Updating to fairly recent driver produced a +100 fold performance improvement.

So if you’re using a GeForce Go 7 series card (laptop) be aware that v84 drivers have serious performance problems in glUniform methods using FloatBuffers.