Commit 08a6562
committed
OSX/MACOS: Fix unreachable NSOpenGLPixelFormat fallback guard
cocoa_gl_ctx.m had a fallback path that retried pixel-format
creation without NSOpenGLPFAAllowOfflineRenderers when the first
-initWithAttributes: returned nil, guarded by
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
MIN_REQUIRED is the deployment target; < 1050 means "the binary
is allowed to run on pre-10.5". NSOpenGLPFAAllowOfflineRenderers
was added in 10.5, so the intent was clearly "compile the fallback
when the SDK or deployment target might not support this flag".
The guard as written is inverted - it only fires when targeting
pre-10.5, not when targeting 10.5+ - so on every shipping build
the fallback was simply dead code.
The guard is also unreachable in practice regardless: the static
`attributes` initializer a few lines above references
NSOpenGLPFAAllowOfflineRenderers unconditionally, which means the
file already demands MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 at the
SDK level just to compile. A pre-10.5 target that somehow got
through would have failed on the attribute reference long before
reaching this code.
Just remove the guard. The fallback is now always compiled and
only exercised at runtime when the first pixel-format creation
returns nil - which can still happen on early 10.5 builds where
some drivers rejected the offline-renderers flag despite the
constant being exposed, or more generally on any platform where
pixel-format creation fails for any reason. Previously those
cases produced a silently broken state (nil g_ctx, no visible
error) because the function returns true regardless. The
retry-without-flag path gives us one more chance to recover.1 parent bd45086 commit 08a6562
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
433 | 443 | | |
434 | 444 | | |
435 | | - | |
436 | | - | |
437 | 445 | | |
438 | 446 | | |
439 | 447 | | |
440 | | - | |
441 | 448 | | |
442 | 449 | | |
443 | 450 | | |
| |||
0 commit comments