Repository navigation
Update OpenGL ES version from 2.0 to 3.0 - #5871
Gustanator wants to merge 17 commits into
Conversation
Fixes supertuxkart#5869 and adds ~3 FPS to the Android build (in the Black Forest benchmark).
|
I noted some #define's are messed in gles2-ext.h and I didn't edited the files name to OGLES3-related things I will fix them later |
|
By the way, here is the PR apk: https://github.com/Gustanator/stk-code/releases/download/ogles3/android-bata-with-ogles3.apk |
|
That was a quick turnaround. However there are some things to clarify first:
|
|
I just edited the GLES files without change the #ifdefs for a fast change and test, n |
In a Raspberry Pi forum: https://forums.raspberrypi.com/viewtopic.php?t=302164 |
I forgot to make this later. This should force the use of the version 3.0 I need to test this later
…into update-ogles
Explanation in the comment of AndroidManifest.xml:36
It's better to uise an universal name rather than use OGLES3 imo
It's done ;) |
Alayan-stk-2
left a comment
There was a problem hiding this comment.
The majority of the changes are fairly safe renames to remove the misleading GLES2 naming. I had a look over just in case, but that part is fine.
I uncovered a couple of issues, mentioned in my review comments. I have not analyzed the shader code changes to confirm correctness, it will need verification.
In the process of reviewing this, I had a look at code that indicates that CIrrDeviceSDL tries to get a 3.0 context normally, but has a 2.0 fallback. So that confirms that OGLES2 could in theory sometimes happen, but in practice it's already vanishingly rare as very few devices don't support OGLES3 (and even less of those have the required minimum Android version).
There are also potential issues if the legacy device settings is on while using OGLES.
My biggest concern, which hasn't a direct review comment, is with the gles2-ext.h file. That's supposed to be an explicit list of GLES2 extension and their defines (although I'm not too familiar with the specifics), and I think that going in that file to replace various things with GLES3 core equivalent misses the point. If something is already in the main GLES3 headers, why do we need to try to pull the enum values from gles2-ext?
I haven't fully considered the question, but I'm rather confident that's not the right approach.
| std::vector<EGLint> context_attribs; | ||
| context_attribs.push_back(EGL_CONTEXT_MAJOR_VERSION); | ||
| context_attribs.push_back(2); | ||
| context_attribs.push_back(3); |
There was a problem hiding this comment.
This change sits within
else if (m_creation_params.opengl_api == CEGL_API_OPENGL)
That's regular OpenGL, which should be left untouched by any OGLES change done in this PR.
There was a problem hiding this comment.
This kind of stuff is why I bother to actually review even when it looks good on the surface, and why reviewing isn't always quick.
|
If the goal is to require GLES 3.0, the old Irrlicht GLES renderer should probably be removed entirely. No point in carrying around an entire render engine that can never be activated (due to STK's own renderer being used). If stripping the old renderer is the path chosen, this PR should look very different. That said, is there any particular benefit to stripping the old renderer?
On Android, perhaps, but e.g. the Raspberry Pi 1-3 use GLES 2, and it's not hard to imagine a decent number of potential users there (especially since STK is included in distro repos). |
I don't know much about the Antarctica Engine (I always thought that the irrlicht forder contains this engine), so I did this basing in afaik the game structure. If someone help me to understand the Antarctica engine, I will be very happy :3 |
Fair point! I hadn't particularly thought about it, but we ought to check in which cases that path is actually taken. If the COGLES titled files are only used for the legacy GLES2 renderer, then there is no real point in modifying them, they should be stripped after confirming they only ever get used in the legacy path. The flow of instructions leading to them would need to be checked. However a file like lib/irrlicht/source/Irrlicht/CContextEGL.cpp contains code about both the modern and legacy path so I would assume it is still relevant.
Currently, the GLES defines lead to some code paths that assume GLES 2.0 instead of being able to take advantage of core GLES 3.0 features. Now, in theory there are other ways this could be handled, like replacing/supplementing the defines with legacy_device checks, but if we don't have to handle the GLES2 case we get less work and meaningful code simplifications. Simpler code is also easier to reason about in the future.
I checked, there are indeed some people reporting playing STK on a Pi 3. I incidentally found an old thread on the Raspberry Pi forums where you participated yourself! But:
Now in fairness, I suppose that users relying on distro package might find installing an old version more difficult than it is with our official packages, although the Linux arm packages that are available should work on Pi devices, I think. |
- Fixed some syntax erros - Changed extensions from .vsh/.fsh to .frag/.vert
…t I forgot to push lol
The game doesn't show a message error while using Legacy driver yet...
|
I removed the gles2-ext.h file (and fixed what was needed) @Alayan-stk-2, you can review now |
|
@qwertychouskie, about the graphics_engine: In nowhere of the ge code I found smth related to GLES (only in irrlicht) |
That's because most rendering code in STK's rendering engine is identical between GL and GLES; the only differences are the Stepping back to a much broader view of this PR: This PR, in its current state, has a lot of changes that don't make sense in the context of a full understanding of all of STK's rendering code. For example, making the legacy Irrlicht renderer require GLES 3.0 doesn't make sense, because then the whole renderer is just a dead code path, since STK's own rendering engine will always be used. If removing GLES 2.0 support, GL 2.x support should probably be ripped out at the same time; i.e. completely remove the legacy Irrlicht renderers ( If removing the legacy Irrlicht renderers is desired, it would probably be best to re-start this work fresh in a new PR, targeting the Evolution branch (not 1.5.x). (Also, this type of bulk-code-removal job may be a good task for an LLM coding tool, as LLMs are often better at "reading" the mass amount of code to find what all can/should be deleted when doing these types of mass-deletions. Copyright concerns with LLM output also aren't really applicable when just using them to delete a bunch of code.) One change I would like to see sooner (and probably on Another (orthogonal) change I'd personally like to see some time is making GL vs GLES a runtime choice (like GL vs Vulkan already is) rather than a compile-time choice. I actually attempted this a while ago (#4439) but it wasn't accepted at the time. If anyone wants to tackle this change, feel free to use that as a base. It will probably need updating though since various rendering code has changed since then, and the GL vs GLES choice should probably also be plumbed into the UI spinner that currently allows selecting GL vs Vulkan, so it allows selecting between GL, GLES, and Vulkan. |
I'm starting to revamp your PR, but I won't start it soon as I'm studying the AngelScript system to fix some warnings (and update it) |

Fixes #5869 and adds ~3 FPS to the Android build (in the Black Forest benchmark).
Tests (OGLES2):
Tests (OGLES3):
Agreement