Since we’re currently updating our texture compression pipeline, we’re also looking into updating our backend to support OpenGLES 3.0 + WebGL 2.
This is necessary in order to support texture formats like ASTC and ETC2.
The big questions are when and how to do it.
Current status
Currently, this is the status of the OpenGLES 3 / WebGL 2 support.
iOS - supports ES 3.0 since iOS 7 (we only support 8 and above)
Android - supports ES 3.0 since Android 4.3 (api 18). Only 0.7% of the Android users use this version. Our minimum version is Android 4.1. Also, on the devices I’ve tested, I already get an OpenGLES 3 context.
HTML5 - Firefox/Chrome/Edge support WebGL 2 (76% support), Safari is in the works, and we can probably expect it in the next few months.
Proposal
We use Emscripten to compile our HTML5 builds, and there’s an option to make it check support for WebGL 2 first, then fallback to WebGL 1. I’ve just tested it, and it seems to work fine. It does come with an extra 32kb cost in engine size. (That cost is probably saved anyways once you start using compressed textures).
Preferably, I’d like to keep things simple and update all platforms at the same time.
In short: update iOS and Android to OpenGLES 3, and HTML5 to use WebGL 2 (+1 fallback). Android minimum sdk would also have to be updated to 4.3 (api 18).
As for actual OpenGL callas inside the engine, we won’t be changing or adding anything.
This change in itself should be very small, and could be available very soon (e.g. 1.2.180)
An alternative would be adding an option to the game.project (e.g. “graphics.use_opengles3=1”) to give ultimate control to the developer. I feel that route costs more than it’s worth.
Potential issues
The only technical issue I see could arise is if the developer uses OpenGLES 3 features during development, but when then testing on HTML5 and gets a WebGL 1 browser, some potentially confusing shader errors might arise.
Feedback
I’d like to hear your thoughts around this matter.
E.g. are you actively targeting OpenGLES 2 / WebGL 1? what usecase do you have? Do you see any other potential issues that I’ve missed?
Starting A8 ASTC supports on iOS (iPhone6 and above). That means iPhone5s and below supports only PVRTC (you didn’t mention it, I decided to clarify a bit). But OpenGL3 is already not an issue on iOS ofc. (starting iPhone 5s they support Metal).
For Android, if I filter by API version in Google Play Console I see less than 1.4% - 1.6% (not 0.7% but yes, not too much). But if I check by OpenGL filter, then numbers are different:
Installs on active devices (last 30 days):
32018 - All supported devices
29297 - OpenGL 3, 3.1, 3.2
31570 - API 18+
312958 - All supported devices
285701 - OpenGL 3, 3.1, 3.2
308192 - API 18+
According to this data the devices that support only OpenGL2 are about 9.3-9.5%.
So, it’s not only about SDK API version. Increasing API version itself is fine, I think but not sure if it’s fine turn off OpenGL2.
Fallback for WebGL1 is definitely important for HTML5 target.
So, I have possibility to filter out devices by API and OpenGL version (and some other options, but it’s not important right now).
I see the count of Installs on active devices (last 30 days). For one of the game it’s 312958. If I chose in filters API 18+ :
Agree here. Mobile and Desktop are definitely ok. No need for a project wide setting.
Having fallback for html5 is instead needed especially if you want to support mobile web.
As for me it’s fine to use OpenGL3-only on mobile platforms. I don’t have monetisation. Even if I had, there are not too many ADS networks support API 16 (I know AdMob supports, but Unity Ads not).
But as I said, WebGL1 fallback is important.
Yes, maybe it would be better.
My main point here that OpenGL version depends not only on API version, but hardware.
It works only one way like: OpenGL3 requires android 4.3 but Androd 4.3 doen’t require OpenGL3. That means device might have Android 4.3 with OpenGL2 and maybe even higher Android version.
To make sure we’re not overlooking features:
One thing that we’d like to use from an OpenGL ES 3 standpoint however, is instancing.
There are extensions in OpenGL ES 2 for this, which would be needed for WebGL 1. But for Android, I’m not sure those extensions exist for such old Android versions. So, once we start supporting it, we’ll likely make the OpenGLES 3 the hard lower limit.
This means that the app will be installed on devices that supports at least OpenGLES 2. It might also support OpenGLES 3.
So, together with the snippet above, you can still target OpenGLES 2 if you want to.
There are many low-end mobile devices with GPU Mali-400. This GPU supports only OpenGLES 2, ETC1 textures, no vertex texture fetch, mediump as max precision in fragment shaders. I have a smartphone with this GPU (Tecno Pop 2F 2019, Android 8.1 Go) to test our games. It’s slow, but it runs Brawl Stars pretty well, i.e. one of the most popular mobile games.
Also, our publisher’s target for desktop users is a PC with Intel GMA X4500. This GPU supports DirectX 10.0, and it’s capable of running WebGL 1.0 (not 2.0) on Windows 7 – see the WebGL report.
So, it’s important for me to have WebGL 1.0 and OpenGLES 2 as a fallback. As long as possible!
And we released an HTML5 game two months ago, which we have been using to gather some anonymous info from our users. The info is a GPU name from UNMASKED_RENDERER_WEBGL. The results are interesting… because it’s a Mahjong game and the audience is quite elderly. The raw data is here, and I made pie charts from it assuming that
Since I didn’t have access to any device actually running OpenGLES 2, I used Android Studio to create a virtual device. And after some fixes, we now support both OpenGLES 3 and 2 (as fallback). No changes needed on your part.
Same goes with WebGL. We support both versions, if WebGL 2 isn’t supported, we fallback to WebGL 1.
These changes are in the alpha build so if possible, it would be great if you could verify everything works as expected.
Also, our publisher’s target for desktop users is a PC with Intel GMA X4500. This GPU supports DirectX 10.0, and it’s capable of running WebGL 1.0 (not 2.0) on Windows 7 – see the WebGL report.
Just to be clear, for the Windows version, are you talking about OpenGL or WebGL? (I’m guessing we’re talking about a browser exclusive game?)