Skip to content

Conversation

@icculus
Copy link
Collaborator

@icculus icculus commented Oct 6, 2025

Note that this should work with GLES1, don't let the "es2" in WGL_EXT_create_context_es2_profile fool you.

Fixes #13056.

Note that this should work with GLES1, don't let the "es2" in
WGL_EXT_create_context_es2_profile fool you.

Fixes libsdl-org#13056.
@icculus
Copy link
Collaborator Author

icculus commented Oct 6, 2025

This is a draft because I haven't tested or even compiled this yet; do not merge yet!

@slouken slouken added this to the 3.4.0 milestone Oct 8, 2025
@icculus icculus marked this pull request as ready for review October 9, 2025 16:58
@icculus
Copy link
Collaborator Author

icculus commented Oct 9, 2025

Okay, not only does this work, it makes testgles2 run on my Windows box, where it would fail to create a context at all before!

(On Nvidia's latest drivers, the EGL path fails trying to load libGLESv2.dll, but it makes a GLES2 context just fine through WGL with the extension!)

The only things that look like "libEGL.dll" or "libGLESv2.dll" are in web browser things: Firefox, Edge, CEF...I assume these are copies of ANGLE. It doesn't look like Nvidia ships an EGL with their drivers at all, so this patch is probably the only way to use "native" GLES2 on Windows.

@icculus icculus merged commit ef1d4ed into libsdl-org:main Oct 9, 2025
43 checks passed
@icculus icculus deleted the sdl3-wgl-egl branch October 9, 2025 17:08
return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, false) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); // No WGL extension for OpenGL ES 1.x profiles.
// (we don't need EGL to do OpenGL ES if HAS_WGL_EXT_create_context_es2_profile exists.)

return !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile || SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, false) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); // No WGL extension for OpenGL ES 1.x profiles.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you split this out into multiple lines for sanity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual problematic check is still in here also _this->gl_config.major_version == 1 || (without removing this gles1 profiles are still not able to be created)

@icculus
Copy link
Collaborator Author

icculus commented Oct 9, 2025

Whoops, okay, fixing the GLES1 thing (and splitting it into multiple lines).

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.

SDL2 and 3: Impossible to create OpenGL ES 1.0 context via wgl

3 participants