Skip to content
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

Prefer to create an OpenGL 3.2 (forward-compatible) context by default #245

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jellysquid3
Copy link

@jellysquid3 jellysquid3 commented Feb 13, 2025

This pull request makes it so the early display no longer attempts to "upgrade" the OpenGL context to the latest available version. A config option (disabled by default) is added which allows this behavior to be enabled again in case we introduce breakages, but the goal should be to eventually remove it.

Since the default behavior is changed to only request an OpenGL 3.2 Core context, mods which previously looked at the context version will now need to instead query the available extensions using GLCapabilities in LWJGL.

Note that this is a potentially breaking change. However, of the mods found so far that even request a higher context version, all but one of them has been verified as not needing the context upgrade in the first place. We can submit patches to these mods if necessary to have them look at the GLCapabilities instead.

Motivations:

  • Some OpenGL behavior is known to change (notably integer normalization) if a different context version is requested explicitly. When an OpenGL 3.2 (forward-compatible) context is used, this behavior is consistent regardless of what capabilities the hardware supports.
  • Even though such hardware is becoming rare, attempting to create an OpenGL context multiple times can take a very long time on older hardware, especially when NeoForge needs to fail downwards from GL 4.6 all the way to GL 3.2.
  • Some graphics drivers on Windows (older AMD Radeon HD) will fail to correctly handle a context re-initialization and instead crash out.
  • There is also third-party software on Windows which is known to try and replace the OpenGL context by hooking WGL, and cannot survive context re-initialization.

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@jellysquid3 jellysquid3 marked this pull request as draft February 13, 2025 20:21
@jellysquid3 jellysquid3 force-pushed the patch/prefer-forward-compat-gl32-context branch from 764c1ea to d520955 Compare February 13, 2025 21:20
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