mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-19 07:01:02 +00:00
Avoid retrying renderer init if we know the error was not transient
This commit is contained in:
@@ -55,9 +55,6 @@ typedef struct _OVERLAY_VERTEX
|
||||
SDL_LOG_CATEGORY_APPLICATION, \
|
||||
"EGLRenderer: " __VA_ARGS__)
|
||||
|
||||
SDL_Window* EGLRenderer::s_LastFailedWindow = nullptr;
|
||||
int EGLRenderer::s_LastFailedVideoFormat = 0;
|
||||
|
||||
EGLRenderer::EGLRenderer(IFFmpegRenderer *backendRenderer)
|
||||
:
|
||||
IFFmpegRenderer(RendererType::EGL),
|
||||
@@ -407,6 +404,7 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
// https://hg.libsdl.org/SDL/rev/84618d571795
|
||||
if (!SDL_VERSION_ATLEAST(2, 0, 10)) {
|
||||
EGL_LOG(Error, "Not supported until SDL 2.0.10");
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -418,15 +416,6 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
return false;
|
||||
}
|
||||
|
||||
// HACK: Work around bug where renderer will repeatedly fail with:
|
||||
// SDL_CreateRenderer() failed: Could not create GLES window surface
|
||||
// Don't retry if we've already failed to create a renderer for this
|
||||
// window *unless* the format has changed from 10-bit to 8-bit.
|
||||
if (m_Window == s_LastFailedWindow) {
|
||||
EGL_LOG(Error, "SDL_CreateRenderer() already failed on this window!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// This hint will ensure we use EGL to retrieve our GL context,
|
||||
// even on X11 where that is not the default. EGL is required
|
||||
// to avoid a crash in Mesa.
|
||||
@@ -451,6 +440,7 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
}
|
||||
if (renderIndex == maxRenderers) {
|
||||
EGL_LOG(Error, "Could not find a suitable SDL_Renderer");
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -480,8 +470,7 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
|
||||
// Now we finally bail if we failed during SDL_CreateRenderer() above.
|
||||
if (!m_DummyRenderer) {
|
||||
s_LastFailedWindow = m_Window;
|
||||
s_LastFailedVideoFormat = params->videoFormat;
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -489,15 +478,18 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
SDL_VERSION(&info.version);
|
||||
if (!SDL_GetWindowWMInfo(params->window, &info)) {
|
||||
EGL_LOG(Error, "SDL_GetWindowWMInfo() failed: %s", SDL_GetError());
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(m_Context = SDL_GL_CreateContext(params->window))) {
|
||||
EGL_LOG(Error, "Cannot create OpenGL context: %s", SDL_GetError());
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
if (SDL_GL_MakeCurrent(params->window, m_Context)) {
|
||||
EGL_LOG(Error, "Cannot use created EGL context: %s", SDL_GetError());
|
||||
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user