SDL: Set framebuffer_srgb_capable to the actual value obtained (#8634)

From 594a79c2f9db21a11a76c012b2b1655a21fc8982 Mon Sep 17 00:00:00 2001
From: "Jake S. Del Mastro" <[EMAIL REDACTED]>
Date: Tue, 28 Nov 2023 08:48:19 -0500
Subject: [PATCH] Set framebuffer_srgb_capable to the actual value obtained
 (#8634)

---
 src/video/windows/SDL_windowsopengl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index 8bbd62e4ad39..bb9be340a6d4 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -527,6 +527,9 @@ static int WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
     int pixel_format = 0;
     unsigned int matching;
 
+    int qAttrib = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB;
+    int srgb = 0;
+
     hwnd =
         CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0,
                      10, 10, NULL, NULL, SDL_Instance, NULL);
@@ -548,6 +551,10 @@ static int WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
                                                     &matching);
         }
 
+        /* Check whether we actually got an SRGB capable buffer */
+        _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb);
+        _this->gl_config.framebuffer_srgb_capable = srgb;
+
         _this->gl_data->wglMakeCurrent(hdc, NULL);
         _this->gl_data->wglDeleteContext(hglrc);
     }