floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
7.12k stars 501 forks source link

sokol_app.h: Full GLES support #966

Closed automainint closed 9 months ago

automainint commented 10 months ago

Currently, GLES support is missing on

My implementation for Linux: #965 I don't have a Windows or macOS machine, so I can't do those.

floooh commented 10 months ago

Adding new GL related functionality on macOS doesn't make a lot of sense, since Apple has deprecated OpenGL on Mac (and since macOS also only supports the OpenGL Core Profile, GLES wouldn't be supported anyway)

Similar on Windows btw, I'm not sure that the regular OpenGL drivers contain GLES APIs. Usually one would link with ANGLE for that.

Also as I wrote in the PR, unless there's a very good reason why supporting GLES on desktop operating systems is needed, I'm not a big fan of the idea since it leads to more configurations that need to be tested.

automainint commented 10 months ago

The reason is to have one graphics API on all platforms, as a wrote in the PR comment

Apple has deprecated OpenGL

That's very unfortunate. But it's weird, they still run WebGL in browser, so they must have some kind of support for it, do they cross-compile shaders to Metal? I'm also looking into shader cross-compilation, but I hoped to have a way to just use a single API.

floooh commented 10 months ago

they still run WebGL in browser, so they must have some kind of support for it

WebGL is running on top of Metal in Safari (via the ANGLE library - same on Windows btw, WebGL is actually running on top of D3D11 via ANGLE, not OpenGL). Apple's native OpenGL implementation has been frozen at 4.1 core profile and is also running on top of Metal for quite a while now.

The reason is to have one graphics API on all platforms, as a wrote in the PR comment

It wouldn't be supported out of the box on Windows and macOS without a third party library (ANGLE). If you want to author shaders in a single shading language, the best option is to use one of the shader cross-compiling tools (like Google's shaderc, the SPRIVCross command line tool, or sokol-shdc.

floooh commented 9 months ago

I'm closing this ticket since it turned out to be a dead-end (sokol_app.h supports creating a GLES3 context in the Linux backend via EGL, but on other platforms that's impossible or would require linking with ANGLE).