[Fix] (MG_Backend): track EGL backend surfaces

This commit is contained in:
2026-07-03 09:15:26 +08:00
parent bdf29fc4d5
commit 6ecefaec75
4 changed files with 126 additions and 83 deletions
+12
View File
@@ -276,7 +276,18 @@ namespace MobileGL {
EGLContext Context = EGL_NO_CONTEXT;
};
struct EGLSurfaceState {
SurfaceKind Kind = SurfaceKind::None;
WindowHandle Window;
EGLint Width = 1;
EGLint Height = 1;
};
void ResetEGLRuntimeState();
Bool RegisterEGLWindowSurface(EGLSurface surface, const WindowHandle& handle);
Bool RegisterEGLPbufferSurface(EGLSurface surface, EGLint width, EGLint height);
const EGLSurfaceState* GetRegisteredEGLSurface(EGLSurface surface) const;
Bool ActivateEGLSurface(EGLSurface surface);
virtual Bool InitPbufferSurface(EGLint width, EGLint height);
FormatCapabilityCache& MutableFormatCapabilities();
@@ -290,6 +301,7 @@ namespace MobileGL {
Bool m_backendCapabilitiesInitialized = false;
SurfaceKind m_eglSurfaceKind = SurfaceKind::None;
UnorderedMap<std::thread::id, EGLCurrentState> m_eglCurrentThreads;
UnorderedMap<EGLSurface, EGLSurfaceState> m_eglSurfaces;
};
} // namespace MG_Backend
} // namespace MobileGL