- August 10, 2012 at 9:14 am #30940
Hello.Recently, I am using many varyings in my shader.How many varying variables can I use in a GLSL ES shader ?I searched this issue, and some people says only 8 varyings can be used on GLSL ES.Maybe there are limitations depending on hardware.I’m usually working on iPad 3rd gen and iphone 4s.Thanks in advance.August 10, 2012 at 11:14 am #36056
You can query the maximum value with glGet(GL_MAX_VARYING_VECTORS). The OpenGL ES 2.0 manual pages have more information about this: http://www.khronos.org/opengles/sdk/docs/man/
It’s worth noting that on some PowerVR platforms, the compiler will not pack for you – if 8 varying vectors are available, you need to ensure that you are only using a maximum of 8 vec4 varyings. This means that you may not be able to, for example, have 7 vec4 varyings and 4 float varyings as the compiler may not be able to pack this into 8 vec4’s automatically.
JoeAugust 11, 2012 at 9:39 pm #36057
Thanks, Joe.I just tested on a simulator because I don’t have a device now.On the iPhone simulator, glGet gave me 8.Actually, I need 12 varying variables for my shader.So I may be able to declare them as 3 vec4 vectors.Am I on a right way ?August 12, 2012 at 5:44 am #36058
If you run the free app: OpenGL Extension Viewer (available on both iOS and Android), you can find many information about OpenGL ES capability.Both of my iPod Touch 4G (SGX 535) and iPad 2 (SGX 543) have 8 varying vectors.