Fix initialization crash on iOS GLES 2.0 devices#7047
Fix initialization crash on iOS GLES 2.0 devices#7047harry-cpp merged 2 commits intoMonoGame:developfrom
Conversation
Fall back to GLES 2.0 after first attempting to initialize GLES 3.0
|
The issue fixed by this change is described in #7051 |
|
That is weird,. Apple said iOS 7 or above support gles 3, but actually it's not true? |
|
The short answer is that iOS 7 and above does support GLES 3, but not on all devices. Some devices only support GLES 2 no matter what version of iOS they're running. If you check out Apple's Device Compatibility Reference, you can see that some devices like the iPhone 5 and the iPad 3 don't support GLES 3, however, they support up to iOS 9. I also have a physical iPad 3 device running iOS 9 that I test on and that's how I found the issue. It definitely doesn't support GLES 3 but works fine with my fix to fall back to GLES 2. So yes, it's definitely not true that iOS 7 or above supports GLES 3. Based on the chart referenced above, 64-bit devices support GLES 3 and 32-bit devices do not, and iOS 9 is the last supported OS for 32-bit CPU's. So you could say that iOS 10 and above coincidentally supports GLES 3, but iOS 9 supports some devices that are GLES 2 and some that are GLES 3. The conclusion is that an OS version check cannot be used to determine the GLES version prior to iOS 10. It seems better to try for GLES 3 and fall back to GLES 2 per the developer documentation. |
|
This seems fine to me, was gonna suggest avoiding try / catch, but there really does not seem to be a way to detect if the device supports GLES3 from C#, unless we want to manually invoke the create method or hardcode GLES2 devices, which I would rather not do, so merging! Thanks @dtaylorus! |
Fall back to GLES 2.0 after first attempting to initialize GLES 3.0 rather than assuming the GLES version based on the iOS version as per the Apple developer documentation (see Listing 2-1).
Tested on an iPad 4 running iOS 9.3.5 (GLES 2.0) and an iPad 6 running iOS 13.3.1 (GLES 3.0).