From f6360eadee2f1cb21208477ebe65cee89ffca35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Feb 2024 13:04:57 +0100 Subject: [PATCH] NSGL: Fix missing check for OpenGL profile macOS only provides the core profile for OpenGL 3.2 and later. --- README.md | 2 ++ src/nsgl_context.m | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 787560a6..b7ea493a 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,8 @@ information on what to include when reporting a bug. - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [NSGL] Removed enforcement of forward-compatible flag for core contexts + - [NSGL] Bugfix: A core profile OpenGL context was returned if 3.2+ + compatibility profile was requested - [EGL] Added platform selection via the `EGL_EXT_platform_base` extension (#442) - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension diff --git a/src/nsgl_context.m b/src/nsgl_context.m index d19622c6..0b58e20a 100644 --- a/src/nsgl_context.m +++ b/src/nsgl_context.m @@ -175,6 +175,13 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, } } + if (ctxconfig->major >= 3 && ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) + { + _glfwInputError(GLFW_VERSION_UNAVAILABLE, + "NSGL: The compatibility profile is not available on macOS"); + return GLFW_FALSE; + } + // Context robustness modes (GL_KHR_robustness) are not yet supported by // macOS but are not a hard constraint, so ignore and continue