Skip to content

Conversation

@Shivansps
Copy link
Contributor

@Shivansps Shivansps commented Dec 4, 2025

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant