Shaders, possible optimization?

Started by lawless_c, September 08, 2014, 03:28:42 PM

Previous topic - Next topic

lawless_c

This is just thought i haven't had a chance to try yet.

But i have multiple floats being sent to a shader, at the moment i do them one at a time.
Would it make more sense to simply add all these floats to an array and send them in one setUniform command?

So instead of using

setUniform(String name, float val) ;
setUniform(String name, float val) ;
setUniform(String name, float val) ;
setUniform(String name, float val) ;


I would use setUniform(String name, float[] val) ;

EgonOlsen

It might be faster, but i never noticed that setting uniforms is any kind of bottleneck. I wouldn't sacrifice the comfort of having distinct uniforms for some mystical gain that most likely doesn't really exist.