-
Notifications
You must be signed in to change notification settings - Fork 178
Add OpenGL ES Compatibility Layer #7137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Shivansps
wants to merge
34
commits into
scp-fs2open:master
Choose a base branch
from
Shivansps:gles-compatibility-layer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MSAA will need an alternative path for GL ES using GL_EXT_multisampled_render_to_texture and GL_EXT_multisampled_render_to_texture2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I separated this work into its own PR.
As things are, OpenGL ES works, it has some issues, the most notable of those being:
-OpenXR does not compile with ES enabled, so it is be disabled if you enable to compile with GLES
-Deffered lightning is broken, this is likely an issue on driver side not related to the port itseft
-MSAA rendering path does not work, and it will be disabled if you try to enable it
-Shadows are working but they are a little weird
But other than that, its usable, its stable, i played until halfway into the retail campaign with it on my phone. I belive the remaning issues could be tackled one by one at some point later if desired.
How this works:
Needs OpenGL ES 3.2 / 320 ES shader model
ES Compatibility layer is an opt-in at compile/cmake config time, you need to enable it with "-DFSO_BUILD_WITH_OPENGL_ES=ON", without this enabled there is no changes applied at the code during compile or runtime because 99% of the changes are made with #ifdefs.
When enabled, a diferent glad loader for GLES is used, and a header file "es_compatibility.h" is now included in all files that use functions and enums not present on OpenGL ES 3.2. Also intercepts calls to glTexSubImage3D(), glTexImage2D(), glTexImage3D() and glReadPixels(), this is done to deal with the incompatible type/format/internalformat combinations used in FSO uncompressed textures not supported in GLES, by doing it here, it allows GLES to run without having to do mayor rewrites of the code. In this way OpenGL can still be developed as the main API with the ES compatibility being adjusted later if needed.
This file that originally only meant to have the missing stuff for ended up having to add code to deal the incompatibilities.
When compiling with OpenGL ES, imgui needs to be linked to a GLES 3.0 library, on linux this is done automaticly but it will add "libgles2-mesa-dev" package dependency. On Windows you can choose not to link imgui with a GLES lib, it will work, but the game will crash when you try to use imgui, like when entering in the options->F3 menu. So to avoid this on windows an optional cmake option is added "ANGLE_ROOT", for example, you can set it with "-DANGLE_ROOT=H:\angle_x64", you can get a compiled angle lib from here https://github.com/mmozeiko/build-angle/releases
To run with GLES, you need special gles external shaders, current WIP version is this one
gles_shaders_v3.zip
These shaders are also uploaded to nebula
And on Windows, you need a OpenGL ES wrapper dll next to the executable, the angle dlls are compiled with dx so it supports 3.0 max what is not enoght, so im also attaching the mesa zink wrapper dlls to run GLES over Vulkan.
zink_gles.zip