Maximum number of varyings ?

This topic contains 4 replies, has 3 voices, and was last updated by  Joe Davis 5 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30940

    WonwooLee
    Member

    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. 
    #36056

    Joe Davis
    Member

    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/

    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.

    Thanks,
    Joe

    #36057

    WonwooLee
    Member

    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 ? 
    #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.
    #36059

    Joe Davis
    Member

    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

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.