Fix: skip legacy ARB-extension name check on core-profile GL contexts - #3022
Fix: skip legacy ARB-extension name check on core-profile GL contexts#3022tomjn wants to merge 1 commit into
Conversation
The engine checks for ARB_multitexture, ARB_texture_env_combine, ARB_texture_compression, ARB_texture_float, ARB_texture_non_power_of_two, and ARB_framebuffer_object extensions by name. Per the GL spec, these were folded into core GL 1.3-3.0; core-profile contexts no longer advertise them by name, but their functionality is guaranteed. The name-only check is a false-negative on any core-profile context. Skip it when the active context is core profile so the engine doesn't spuriously reject otherwise-valid configurations.
There was a problem hiding this comment.
Looks reasonable, though glContextIsCore seems to also have an alternative resolution by looking at some gl_ARB compat var rather than at the actual "is core" bit so I'm not sure how reliable it is at the edge case:
RecoilEngine/rts/Rendering/GlobalRendering.cpp
Lines 1881 to 1884 in 4d76fd8
|
@sprunk so I nudged Claude about this and it sort of agreed with you but not quite
The one thing I do remember is that on MacOS for those OpenGL contexts it does support, they were a limited set of core profiles with no compatibility profiles at all ( this was one of the bigger contributors that killed the original springrts macos efforts many years ago ). |
sprunk
left a comment
There was a problem hiding this comment.
The only misfire would require a compat context that advertises no ARB_compatibility and is actually missing a required extension, which would be non-conformant.
In theory the answer is "yes, but there's always been issues with non-conformance so we need to be careful" but maybe the only affected implementations would be so old it doesn't matter much.
lostsquirrel1
left a comment
There was a problem hiding this comment.
Great idea. Though I think we can make it more robust (unless I've misunderstood something.)
| // In an OpenGL CORE profile context these ARB extensions are not advertised | ||
| // by name (they were folded into GL 1.3/2.0/3.0 long ago) but their | ||
| // functionality is guaranteed by the spec. Skip the legacy-extension check. | ||
| if (globalRenderingInfo.glContextIsCore) |
There was a problem hiding this comment.
We usually load the compatibility profile rather than core; we want to also avoid checking for unnecessary extensions.
| // In an OpenGL CORE profile context these ARB extensions are not advertised | |
| // by name (they were folded into GL 1.3/2.0/3.0 long ago) but their | |
| // functionality is guaranteed by the spec. Skip the legacy-extension check. | |
| if (globalRenderingInfo.glContextIsCore) | |
| // All checked ARB extensions are part of the core specification since OpenGL 3.0. | |
| if (globalRenderingInfo.glVersionNum >= 30) |
The only problem with my suggestion is that I can't see where glVersionNum gets correctly initialized. Engine 2025.04 apparently did this, but I'm not seeing it, so it would be worth checking - maybe we have anopther bug because a Lua Platform.glVersionNum depends on this value.
There was a problem hiding this comment.
@sprunk @lostsquirrel1 is this something that needs to be changed or is the PR okay as is? Or is it blocked by #3149? The next steps here appear to be inconclusive/unclear
There was a problem hiding this comment.
I think we need the suggested change, but yes it is blocked by #3149
What
CGlobalRendering::CheckGLExtensions()validates a list of legacy ARB extensions by name. In an OpenGL core profile context these ARB extensions are not advertised by name (they were folded into GL 1.3/2.0/3.0 long ago), even though their functionality is guaranteed by the spec. The name check therefore fails spuriously on a perfectly valid core context.This adds an early return when
globalRenderingInfo.glContextIsCoreis set, skipping the legacy-extension name check on core profiles.Why this is cross-platform
The guard is on the runtime
glContextIsCoreflag, not__APPLE__. It is correct for any core-profile context on any platform; it is a no-op for compatibility-profile contexts (the common case today).Provenance
Extracted unmodified (via
git cherry-pick) from commit17c55deecfin #2991 (the interim macOS bring-up). Original author credit is preserved.glContextIsCorealready exists onmaster, so the change is self-contained.