Dav1dde / glad

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.
https://glad.dav1d.de/
Other
3.73k stars 440 forks source link

Parsing extensions fails with Mesa and GLES2 #446

Closed lephilousophe closed 8 months ago

lephilousophe commented 9 months ago

Using glad 2.0.4 with the following settings.

Calling gladLoadGLES2 with Mesa implementation returns 0 because GLES2 functions are resolved but extensions parsing failed.

This is due to the fact that Mesa returns GLES version 3.2 and glad_gl_get_extensions gets called with this 3.2 version. GLAD_GL_IS_SOME_NEW_VERSION is defined because GL_VERSION_3_0 is defined (as we generate it). The version check occurs and ends up in the version >= 3 branch. Sadly, the GLES2 loader code didn't try to initialize glad_glGetStringi (as it's not defined in GLES2) and the sanity check fails which makes loading extensions fail.

it seems to me that glad_gl_get_extensions should depend on the API calling it and if GLES2 is used, it should always use the basic glad_glGetString(GL_EXTENSIONS) call.

The same should occur for GLES1.

Thanks.