From 2ec9e6558a2263c6033695c2ef3c09bb403b0472 Mon Sep 17 00:00:00 2001 From: Brian Cabral Date: Mon, 9 Mar 2020 08:17:39 -0700 Subject: [PATCH] Only hint at EGL if we're using it. Summary: Fixes a latent bug. "EGL" hints to glfw should only be done if we're using EGL. Reviewed By: aparrapo Differential Revision: D20323563 fbshipit-source-id: 87d5845a31f46fc40d949a0363758f92e6e2b98d --- source/gpu/GlfwUtil.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/gpu/GlfwUtil.h b/source/gpu/GlfwUtil.h index 60fbd6f..4bb513a 100644 --- a/source/gpu/GlfwUtil.h +++ b/source/gpu/GlfwUtil.h @@ -345,8 +345,11 @@ class GlWindow { glfwWindowHint(GLFW_GREEN_BITS, outputBPP); glfwWindowHint(GLFW_BLUE_BITS, outputBPP); -#ifdef __linux__ - glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); +#ifdef USE_EGL_ + // Only use EGL for offscreen rendering. + if (screenState & OFF_SCREEN) { + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); + } #endif window = glfwCreateWindow(width, height, name.c_str(), NULL, NULL);