mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-02-16 10:40:59 +00:00
Restore the original GL attributes after EGLRenderer is destroyed
This commit is contained in:
@@ -66,6 +66,11 @@ 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()
|
||||
@@ -85,6 +90,12 @@ EGLRenderer::~EGLRenderer()
|
||||
}
|
||||
SDL_GL_DeleteContext(m_Context);
|
||||
}
|
||||
|
||||
// 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**)
|
||||
|
||||
@@ -37,5 +37,9 @@ private:
|
||||
PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES;
|
||||
PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES;
|
||||
|
||||
int m_OldContextProfileMask;
|
||||
int m_OldContextMajorVersion;
|
||||
int m_OldContextMinorVersion;
|
||||
|
||||
SDL_Renderer *m_DummyRenderer;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user