From 88d071c5dc5c861119c95562ce616d39496a840a Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 19 Jul 2024 11:28:56 -0400 Subject: [PATCH] EGLBE: Always expose GLX_EXT_framebuffer_sRGB ... regardless of which EGL API version the underlying EGL implementation supports. Referring to 9882331e59c3a8c44defff9c621e971833ca2126, sRGB rendering is required by the OpenGL 3.0 spec. We can't support GLX_ARB_create_context* with EGL 1.4- because eglCreateContext() lacks the necessary attributes, but nothing prevents us from supporting GLX_EXT_framebuffer_sRGB with any EGL API version. (Making that extension contingent upon EGL 1.5 was an error on my part when I authored 9882331e59c3a8c44defff9c621e971833ca2126.) This is known to affect VMware Linux guests. This commit also modifies GLXspheres so that it only checks for the existence of GLX_EXT_framebuffer_sRGB if -srgb is specified. --- ChangeLog.md | 6 ++++++ demos/glxspheres.c | 2 +- server/faker-glx.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 7ff14694..514071f4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -44,6 +44,12 @@ had previously been initialized on the 2D X server without VirtualGL. other elements of the Firefox browser window to disappear when the window was resized. +10. Fixed an issue in the EGL back end whereby `GLX_EXT_framebuffer_sRGB` was +not added to the list of extensions returned by +`glXGetClientString(..., GLX_EXTENSIONS)`, `glXQueryExtensionsString()`, or +`glXQueryServerString(..., GLX_EXTENSIONS)` unless the underlying EGL +implementation supported v1.5 or later of the EGL API. + 3.0.2 ===== diff --git a/demos/glxspheres.c b/demos/glxspheres.c index e459cf19..cc318539 100644 --- a/demos/glxspheres.c +++ b/demos/glxspheres.c @@ -587,7 +587,7 @@ int main(int argc, char **argv) rgbAttribs[19] = 32 - bpc * 3; } - if(!GLX_EXTENSION_EXISTS(GLX_EXT_framebuffer_sRGB)) + if(useSRGB && !GLX_EXTENSION_EXISTS(GLX_EXT_framebuffer_sRGB)) THROW("GLX_EXT_framebuffer_sRGB extension is not available"); c = glXChooseFBConfig(dpy, screen, rgbAttribs, &n); diff --git a/server/faker-glx.cpp b/server/faker-glx.cpp index 28d1e395..7213330a 100644 --- a/server/faker-glx.cpp +++ b/server/faker-glx.cpp @@ -1,6 +1,6 @@ // Copyright (C)2004 Landmark Graphics Corporation // Copyright (C)2005, 2006 Sun Microsystems, Inc. -// Copyright (C)2009, 2011-2023 D. R. Commander +// Copyright (C)2009, 2011-2024 D. R. Commander // // This library is free software and may be redistributed and/or modified under // the terms of the wxWindows Library License, Version 3.1 or (at your option) @@ -866,7 +866,10 @@ static const char *getGLXExtensions(void) if((faker::eglMajor > 1 || (faker::eglMajor == 1 && faker::eglMinor >= 5)) && !strstr(glxextensions, "GLX_ARB_create_context")) strncat(glxextensions, - " GLX_ARB_create_context GLX_ARB_create_context_profile GLX_EXT_framebuffer_sRGB", + " GLX_ARB_create_context GLX_ARB_create_context_profile", + 1023 - strlen(glxextensions)); + if(!strstr(glxextensions, "GLX_EXT_framebuffer_sRGB")) + strncat(glxextensions, " GLX_EXT_framebuffer_sRGB", 1023 - strlen(glxextensions)); return glxextensions; }