- October 11, 2013 at 7:29 am #31509
we are implementing some computing algorithms using POWEVR based platform. we have a lot of local variables used in our glsl shader code, more than 50 Vec4s.
and our APP get extremely low performance even though the computation isn’t that much high, sometimes, even crushed. so, how many local variables can i use in my shader code? is there a upper limit? thanks!October 11, 2013 at 9:37 am #38084October 16, 2013 at 2:17 pm #38085
Worth noting – you should use glGet() to query the value of GL_MAX_VERTEX_UNIFORM_VECTORS. This value indicates the number of float Uniforms that are supported by a platform. The minimum required value for a conformant OpenGL ES 2.0 device is 128, so this means the maximum number of vec4 Uniforms you can use on these devices is 32 (128/4).
Some devices may let you exceed this limit. Doing so is likely to incur a high performance cost though, as it won’t be possible to cache all Uniform values in registers. Values that can’t be stored in registers will have to be fetched from system memory, which will introduce latency to your render.