SDL2 Android: Hardware acceleration issue on certain devices

Hi there,

I’m currently porting an SDL2 game to Android using the SDL 2.0.5 Android project template. It’s all working great, but using the default hardware accelerated renderer (opengles2) breaks rendering on a handful of Android devices. By “breaks”, I mean the game runs as normal, except on-screen textures start getting mixed up with each other in strange ways that I can’t seem to see a pattern behind. It looks to my eyes like the wrong texture is being used when a rectangle is drawn on-screen, as the contents of each rectangle appears to be valid texture data, but it’s being used for the wrong thing and is obviously stretched as its being used in rect sizes it wasn’t intended for. I’ve seen it happen on a Blackberry Priv, LG V10, Galaxy S7, EMUI 4.0, Galaxy Note 4, and Xaomi Redmi 3S so far. All of these phones are running Android 6.0.1 or 5.1.1. On other devices everything works perfectly with the exact same APK. If I use the software renderer instead, the issue goes away, though another problem appears which I’ll post about in a separate thread.

Has anyone experienced anything like this before, and is this a known bug with SDL2 or is it perhaps indicative that my game is doing something in an unorthodox manner that I should find the root cause of?