Imagination PowerVR SDK Blog

extremely low performance with too many local variables used in glsl code


#1

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!


#2

Hi,



Can you share example shader source with us here or email it to our devtech@imgtec.com address?



If you company is willing to sign our NDA, we can share our GLSL ES disassembly compilers with you. The steps required to sign our NDA are outlined on this webpage.



Regards,

Joe


#3

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.



Regards,

Joe