From a2e47d2d0ec069bd0a0b115c984278331de98071 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Mar 2019 09:46:46 +0530 Subject: [PATCH] EGL: Warn if non-blocking swap buffers is not available --- glfw/egl_context.c | 10 +++++++++- glfw/egl_context.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/glfw/egl_context.c b/glfw/egl_context.c index b2d11a471..604582c1b 100644 --- a/glfw/egl_context.c +++ b/glfw/egl_context.c @@ -612,6 +612,15 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, window->context.egl.config = config; + EGLint a = EGL_MIN_SWAP_INTERVAL; + if (!eglGetConfigAttrib(_glfw.egl.display, config, a, &a)) { + _glfwInputError(GLFW_VERSION_UNAVAILABLE, "EGL: could not check for non-blocking buffer swap with error: %s", getEGLErrorString(eglGetError())); + } else { + if (a > 0) { + _glfwInputError(GLFW_VERSION_UNAVAILABLE, "EGL: non-blocking swap buffers not available, minimum swap interval is: %d", a); + } + } + // Load the appropriate client library if (!_glfw.egl.KHR_get_all_proc_addresses) { @@ -783,4 +792,3 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle) return window->context.egl.surface; } - diff --git a/glfw/egl_context.h b/glfw/egl_context.h index 633d98485..534beb8c8 100644 --- a/glfw/egl_context.h +++ b/glfw/egl_context.h @@ -87,6 +87,8 @@ typedef struct wl_egl_window* EGLNativeWindowType; #define EGL_NO_DISPLAY ((EGLDisplay) 0) #define EGL_NO_CONTEXT ((EGLContext) 0) #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0) +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001