Repository navigation
Desktop OpenGL 4.6: fall back to the newest available version (Windows / Linux) - #8580
Conversation
Linux test results (PR head 4c23df3)Machine: Ubuntu 26.04 LTS, kernel 7.0.0-30, aarch64 VM (Parallels on Apple M1 Max), Wayland session. OF forces GLFW's X11 backend (
Test app: requested version from A. Native driver (virgl, max 4.0)
B. llvmpipe (max 4.5)
C. Forced lower maximum (
|
| Driver + override | Context | OF | GLSL | Fallback | Compute/SSBO | Result |
|---|---|---|---|---|---|---|
| llvmpipe, 4.3 / 430 | 4.3 | 4.3 | 430 | yes | PASS | PASS |
| llvmpipe, 3.3 / 330 | 3.3 | 3.3 | 330 | yes | n/a | PASS |
| virgl, 3.3 / 330 | 3.3 | 3.3 | 330 | yes | n/a | PASS |
D. Baseline: master (be82516), same app
| Config, requesting 4.6 | master | this PR |
|---|---|---|
| virgl | couldn't create GLFW window, segfault (exit 139) |
4.0, PASS |
| llvmpipe | couldn't create GLFW window, segfault (exit 139) |
4.5, PASS |
| llvmpipe + override 4.3 | couldn't create GLFW window, segfault (exit 139) |
4.3, PASS |
| llvmpipe + override 3.3 | couldn't create GLFW window, segfault (exit 139) |
3.3, PASS |
Master log for each of these:
[ error ] ofAppGLFWWindow: 65543: GLX: Failed to create context: GLXBadFBConfig
[ error ] ofAppGLFWWindow: couldn't create GLFW window
Requesting 4.5 on llvmpipe works on master as well, so the PR doesn't change requests the driver can satisfy.
Log checks
- Every fallback run: exactly one
OpenGL X.Y is not available, using OpenGL A.Bwarning and one GLFW error line (the first failure). The retries are silent. - No shader compile/link errors from OF's built-in shaders in any run.
- No crashes on exit; all PR runs exited 0.
Not covered
- No driver that creates 4.6 directly. virgl tops out at 4.0, so "Linux, native GPU driver: 4.6 directly" still needs a run on NVIDIA / radeonsi / iris.
- E (Wayland vs X11): not applicable here. OF always forces GLFW's X11 platform, and there's no plain X11 session on this VM.
- Unrelated to this PR: on virgl, the 2.1 (fixed-function)
ofSaveScreencapture is blank white, even though its FBO checks pass. The output is byte-for-byte identical on master.
Screenshots to follow.
Windows test results: PASSEnvironment
Each run checks: OF version <= context version, an A. Native driver: Parallels GL 4.3 (ARM64 exe; the x64 exe gives the same results)
B. Mesa llvmpipe (x64 exe). Mesa 26.2.4 llvmpipe exposes 4.6 now (not 4.5), so 4.6 is created directly.
C. llvmpipe with
D. Baseline vs PR
Logs. At 4c23df3, each fallback run logged one GLFW error ( No core context at all (llvmpipe capped at 3.1, request 4.6 or 3.2). The PR logs the GLFW error from the first attempt once, then Not tested: a real 4.6 vendor driver (NVIDIA/AMD/Intel), RDP, GLon12, msys2, and |
|
Tested on Windows and Linux all successfully |
Requesting a GL version the driver can't create (e.g. 4.6 on a driver that tops out at 4.5, Mesa llvmpipe, or macOS's 4.1) made glfwCreateWindow fail and the app exit with "couldn't create GLFW window". ofAppGLFWWindow now retries 4.6 -> 4.5 -> ... -> 3.2 (only versions below the request) and logs a warning with the version it used. The window settings are updated, so ofGLProgrammableRenderer is set up with the context's real version and shaders get the matching #version (e.g. 450 instead of 460). GLFW errors from the retries are silenced; the first failure is still logged. Requests the driver can satisfy are unchanged.


















Follow-up to #8578 (Android ES 3.1 / 3.2), for desktop OpenGL 4.6 on Windows and Linux.
Requesting 4.6 already works on master:
settings.setGLVersion(4, 6)goes straight to GLFW as a core-profile context,ofGLSLVersionFromGL(4, 6)returns460, and the bundled GLEW hasGL_VERSION_4_6. Templates can pass it throughOF_GL_VERSION_MAJOR/OF_GL_VERSION_MINORfrom #8573.What was missing is the case where the driver can't create the requested version (4.6 on a 4.5 driver, Mesa llvmpipe in CI, older Intel, macOS's 4.1).
glfwCreateWindowfails and the app exits withcouldn't create GLFW window.Change (
ofAppGLFWWindow.cpp)OpenGL 4.6 is not available, using OpenGL 4.5) and update the window settings.ofGLProgrammableRenderer::setupthen gets the context's real version, so built-in shaders use the matching#version(e.g.450, not460).Tested so far: macOS (M1 Max, GL 4.1 max), glMatrix test app
Before this change, requesting 4.6 or 4.3 on macOS failed to open a window.
Still to test (draft)