Remove logic to force the OpenGL ES library to load

This isn't necessary now that we turn on EGL everywhere,
and it breaks OpenGL ES 2.0 support too.
This commit is contained in:
Cameron Gutman
2025-12-27 23:04:40 -06:00
parent d1f43ca258
commit 8a5f34fb01
2 changed files with 6 additions and 26 deletions

View File

@@ -80,11 +80,6 @@ EGLRenderer::EGLRenderer(IFFmpegRenderer *backendRenderer)
{
SDL_assert(backendRenderer);
SDL_assert(backendRenderer->canExportEGL());
// Save these global parameters so we can restore them in our destructor
SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &m_OldContextProfileMask);
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &m_OldContextMajorVersion);
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &m_OldContextMinorVersion);
}
EGLRenderer::~EGLRenderer()
@@ -127,12 +122,6 @@ EGLRenderer::~EGLRenderer()
}
av_frame_free(&m_LastFrame);
// Reset the global properties back to what they were before
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "0");
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, m_OldContextProfileMask);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, m_OldContextMajorVersion);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, m_OldContextMinorVersion);
}
bool EGLRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
@@ -412,8 +401,12 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
// attempt to dereference a null pointer and crash Moonlight.
// https://bugzilla.libsdl.org/show_bug.cgi?id=4350
// https://hg.libsdl.org/SDL/rev/84618d571795
if (!SDL_VERSION_ATLEAST(2, 0, 10)) {
EGL_LOG(Error, "Not supported until SDL 2.0.10");
//
// SDL_HINT_VIDEO_X11_FORCE_EGL isn't supported until SDL 2.0.12
// and we need to use EGL to avoid triggering a crash in Mesa.
// https://gitlab.freedesktop.org/mesa/mesa/issues/1011
if (!SDL_VERSION_ATLEAST(2, 0, 12)) {
EGL_LOG(Error, "Not supported until SDL 2.0.12");
m_InitFailureReason = InitFailureReason::NoSoftwareSupport;
return false;
}
@@ -426,15 +419,6 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
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.
// https://gitlab.freedesktop.org/mesa/mesa/issues/1011
SDL_SetHint(SDL_HINT_OPENGL_ES_DRIVER, "1");
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
int renderIndex;
int maxRenderers = SDL_GetNumRenderDrivers();
SDL_assert(maxRenderers >= 0);

View File

@@ -68,9 +68,5 @@ private:
#define OVERLAY_PARAM_TEXTURE 0
int m_OverlayShaderProgramParams[1];
int m_OldContextProfileMask;
int m_OldContextMajorVersion;
int m_OldContextMinorVersion;
SDL_Renderer *m_DummyRenderer;
};