Odd behaviour with SDL_GL_FRAMEBUFFER_SRGB_CAPABLE on MacOS

I am having some … very odd behaviour with SDL_GL_FRAMEBUFFER_SRGB_CAPABLE on MacOS:

  1. for standard OpenGL setting it to 0 or 1 has no impact. What is interesting is that issuing glDisable(GL_FRAMEBUFFER_SRGB) makes the contents darker regardless to what value SDL_GL_FRAMEBUFFER_SRGB_CAPABLE is set. Querying the value gives me what I set it as, so it is not a case where SDL2 ignores the setting of the value.

  2. for OpenGLES via Angle, setting the SRGB capable to 1, makes SDL_SetVideoMode fail with “Could not create GLES window surface”. Leaving it as 0, I can see that it is darker than it should be, i.e. the same as if rendering with OpenGL system with SDL_GL_FRAMEBUFFER_SRGB_CAPABLE as 1 and glDisable(GL_FRAMEBUFFER_SRGB).

Addendum: Poking into SDL2, I can see that in SDL_egl.c in SDL_EGL_CreateSurface(), it checkes for the extension EGL_KHR_gl_colorspace. However, looking at the EGL1.5 spec, it looks like that if the EGL version is atleast 1.5, then setting EGL_GL_COLORSPACE is ok regardless if the extension is present or not. Removing the extension check, lets SDL2 proceed, but the attribute looks likes its ignored by ANGLE.