Rework how we deal with window re-creation for EGLRenderer

Previously we opted to just lie to SDL and tell it that the current
GL context is actually GLES 3.0 when it wasn't. This meant that
we avoided our window being recreated for GLES usage on Wayland
and KMSDRM, but that meant our 10-bit color change didn't apply
either. I suspect this hackery is what led EGLRenderer to get
stuck in a state where SDL_CreateRenderer() always failed.

Now SDL will recreate our window once to configure a compatible GL
API for our renderer. If that fails, we'll move on to a different
renderer (which may recreate the window again).
This commit is contained in:
Cameron Gutman
2022-01-27 21:49:03 -06:00
parent cdc3352318
commit e64b15d2a7
2 changed files with 58 additions and 15 deletions

View File

@@ -1317,6 +1317,11 @@ void Session::execInternal()
SDL_Delay(500);
#endif
// Request at least 8 bits per color for GL
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
m_Window = SDL_CreateWindow("Moonlight",
x,
y,