mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 07:23:24 +09:00
[Fix] (MG_Impl/EGLImpl, MG_Backend): handle EGL current handoff for NeoForge earlydisplay
Treat valid-display no-surface eglMakeCurrent calls as EGL release requests, keep EGLState and backend current records consistent across threads, and rebind the native DirectGLES EGL context during attach/release. Add EGLState coverage for cross-thread owner transfer and same-thread release/reattach behavior.
This commit is contained in:
@@ -1054,9 +1054,20 @@ namespace MobileGL {
|
||||
EGLContextHandle context) {
|
||||
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
const Bool releaseCurrentRequest =
|
||||
display == EGL_NO_DISPLAY && draw == EGL_NO_SURFACE && read == EGL_NO_SURFACE && context == nullptr;
|
||||
draw == EGL_NO_SURFACE && read == EGL_NO_SURFACE && context == nullptr;
|
||||
const auto threadKey = CurrentThreadKey();
|
||||
if (releaseCurrentRequest) {
|
||||
if (display != EGL_NO_DISPLAY) {
|
||||
auto* displayObject = TryGetDisplay(display);
|
||||
if (!displayObject) {
|
||||
SetError(EGL_BAD_DISPLAY);
|
||||
return false;
|
||||
}
|
||||
if (!displayObject->Initialized) {
|
||||
SetError(EGL_NOT_INITIALIZED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ReleaseThreadUnlocked(threadKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user