Leak resources on linux context shutdown if not bound. Closes #3921

* Linux doesn't support rebinding contexts between EGL (Android binding API) and
  GLX (linux) even if no context is bound, so if one platform is used then the
  other we can't bind our child contexts in order to delete objects when a
  context is destroyed.
* We will have to do the same as we do if a different context is bound, and hope
  that the driver tidies this stuff up for us when the context is deleted.
This commit is contained in:
baldurk committed 2026-10-15 17:27:17 +01:00
1 parent d0ea00bba1
commit 45e91661ee
4 files changed
+7 -1

No files matched your search

+2
View File
@@ -60,6 +60,8 @@ class EGLPlatform : public GLPlatform
RDCDriver m_API = RDCDriver::OpenGLES;
bool m_Debug = false;
bool CanFreshBindOnDeletion() { return false; }
bool MakeContextCurrent(GLWindowingData data)
{
if(EGL.MakeCurrent)
+2
View File
@@ -304,6 +304,8 @@ struct GLPlatform
virtual GLWindowingData MakeOutputWindow(WindowingData window, bool depth,
GLWindowingData share_context) = 0;
virtual bool CanFreshBindOnDeletion() { return true; }
// for pushing and popping a child context. The default implementation just does
// MakeContextCurrent but platforms can override this if they need more complex state handling
virtual bool PushChildContext(GLWindowingData existing, GLWindowingData newChild,
+1 -1
View File
@@ -1136,7 +1136,7 @@ void WrappedOpenGL::DeleteContext(void *contextHandle)
GLWindowingData savedContext;
if(existing.ctx == NULL)
if(existing.ctx == NULL && m_Platform.CanFreshBindOnDeletion())
{
if(m_Platform.PushChildContext(existing, ctxdata.shareGroup->m_BackDoor, &savedContext))
{
+2
View File
@@ -53,6 +53,8 @@ class GLXPlatform : public GLPlatform
RDCDriver m_API = RDCDriver::OpenGL;
bool m_Debug = false;
bool CanFreshBindOnDeletion() { return false; }
bool MakeContextCurrent(GLWindowingData data)
{
if(GLX.glXMakeCurrent)