# Maximum number of varyings ?

**URL:** <https://forums.imgtec.com/t/maximum-number-of-varyings/1493>\
**Category:** PowerVR Insider\
**Created:** [August 10, 2012, 7:14am UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493 "2012-08-10T07:14:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wonwoolee](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wonwoolee](https://forums.imgtec.com/u/wonwoolee)\
**Post date:** [August 10, 2012, 7:14am UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493/1 "2012-08-10T07:14:49Z")

</div>

Hello.&nbsp;

  

Recently, I am using many varyings in my shader.&nbsp;

  

How many varying variables can I use in a GLSL ES shader ?&nbsp;

  

I searched this issue, and some people says only 8 varyings can be used on GLSL ES.&nbsp;

  

Maybe there are limitations depending on hardware.&nbsp;

  

I’m usually working on iPad 3rd gen and iphone 4s.&nbsp;

  

  

Thanks in advance.&nbsp;

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [August 10, 2012, 9:14am UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493/2 "2012-08-10T09:14:51Z")

</div>

Hi,  
  
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/](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&nbsp; 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.  
  
Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![wonwoolee](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wonwoolee](https://forums.imgtec.com/u/wonwoolee)\
**Post date:** [August 11, 2012, 7:39pm UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493/3 "2012-08-11T19:39:37Z")

</div>

Thanks, Joe.&nbsp;

  

I just tested on a simulator because I don’t have a device now.&nbsp;

On the iPhone simulator, glGet gave me 8.&nbsp;

  

Actually, I need 12 varying variables for my shader.&nbsp;

So I may be able to declare them as 3 vec4 vectors.&nbsp;

Am I on a right way ?&nbsp;

---

<div class="post-metadata">

**Author:** ![nirvanauscn](https://avatars.discourse-cdn.com/v4/letter/n/bbe5ce/32.png) [@nirvanauscn](https://forums.imgtec.com/u/nirvanauscn)\
**Post date:** [August 12, 2012, 3:44am UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493/4 "2012-08-12T03:44:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [August 13, 2012, 8:35am UTC](https://forums.imgtec.com/t/maximum-number-of-varyings/1493/5 "2012-08-13T08:35:10Z")

</div>

Hi,  
  
Yes - if you need 12 scalar varying values, it will be best to pack them into vec4’s. This should solve your problem 🙂  
  
Thanks,  
Joe
