Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

OpenGL ES 2.0 Performance on Mobile Devices

Discussion in 'Shaders' started by kromenak, Jan 22, 2013.

  1. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    266
    Hey everyone, I was hoping to get some opinions and input regarding the effectiveness of OpenGL ES 2.0 for Android and iOS development. For my next project, I was hoping to move beyond 1.1 fixed function shaders.

    I've noticed some conflicting information while doing performance research. Android's official documentation seems to imply that 2.0 is faster than 1.1. However, I have also seen some discussions on these forums that mentioned that 2.0 was quite a bit slower than 1.1. But in practical usage, I'm seeing games like Dead Trigger or ShadowGun that seem to be taking advantage of the 2.0 graphics while running quite well.

    Also, I was curious if there is any anecdotal data regarding variance between iOS and Android - do shaders appear pretty similar across devices, or does it vary widely depending on the particular hardware? I'd hate to make shaders on iOS and then discover that on Android it looks terrible.

    So, just a bit confused and seeing a lot of data, some of it quite old and maybe out of date. If anyone can give me the current "lay of the land", it would be a big help.
     
  2. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    If you use equivalent functionality on the same hardware, OpenGL ES 2.0 should usually be faster than OpenGL ES 1.1 because internally a GPU capable of executing OpenGL ES 2.0 is only simulating OpenGL ES 1.1 anyways. That said, using OpenGL ES 1.1 might allow the GPU to use certain optimizations that might not be available in OpenGL ES 2.0. Thus, there might be situations in which OpenGL Es 1.1 is faster.

    In any case, usually you are not using equivalent functionality. And then it becomes tricky. If you use OpenGL ES 2.0 in Unity, it will by default use the forward rendering path (as opposed to the vertex lit rendering path). The default shaders for the forward rendering path can do more things but are also slower than the default shaders for the vertex lit rendering path. Thus, for the same built-in shader, the OpenGL ES 2.0 version (i.e. the forward rendering path version) is usually slower than the OpenGL ES 1.1 version (i.e. the vertex lit rendering path) but that's mainly because you are comparing apples and oranges.

    Thus, if you forget about the built-in shaders and start programming your own shaders, OpenGL ES 2.0 allows you to do exactly what you want (more precisely than with OpenGL ES 1.1) and that means that you are usually able to write an OpenGL ES 2.0 version that is faster. At least in theory, i.e. if you are familiar with all kinds of optimizations. In practice that can be quite hard.

    There are some bugs and differences (of compilers and drivers) and also of the hardware of iOS and Android devices. If you compare the same GPU on an iOS and an Android device and program them in GLSL for OpenGL ES 2.0, there shouldn't be much of a difference.
     
  3. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    266
    Awesome, very informative! I think I'm interested in diving deep into building my own toolbox of shaders specifically for mobile situations, so hopefully I can get some good performance out of it. In any case, good to hear that it is viable, though maybe with more work, to get high performance shaders out of 2.0.