www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: lawless_c on September 08, 2014, 03:28:42 pm

Title: Shaders, possible optimization?
Post by: lawless_c on September 08, 2014, 03:28:42 pm
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) ;
Title: Re: Shaders, possible optimization?
Post by: EgonOlsen on September 08, 2014, 08:53:11 pm
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.