Skip to content

Commit a03a37a

Browse files
keeper-of-memeskblaschke
authored andcommitted
GLResolver: fall back to app-managed EGL/GLES when a user resolver is set
On platforms where the current GL context cannot be probed via the platform's native APIs (e.g. ANGLE on tvOS/iOS, where the app owns an EGL context backed by Metal and there is no system EGL/GLX/WGL to query), GLResolver::Initialize() failed hard even though the embedding application had explicitly supplied a resolver via projectm_create_with_opengl_load_proc(). When a user resolver is present, the app has taken responsibility for providing GL entry points, so an unprobeable context is expected rather than an error: assume an app-managed EGL/GLES context and continue, logging at info level. Behaviour without a user resolver is unchanged (hard error as before).
1 parent 0550c3b commit a03a37a

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/libprojectM/Renderer/Platform/GLResolver.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,20 @@ auto GLResolver::Initialize(UserResolver resolver, void* userData) -> bool
404404
std::string reason;
405405
if (!HasCurrentContext(currentContext, reason))
406406
{
407-
m_loaded = false;
408-
LOG_ERROR(std::string("[GLResolver] No current GL context present: ") + reason);
409-
return false;
407+
if (state.m_userResolver != nullptr)
408+
{
409+
currentContext.eglCurrent = true;
410+
currentContext.eglAvailable = true;
411+
LOG_INFO(std::string("[GLResolver] Current context could not be probed: ") +
412+
reason +
413+
"; assuming app-managed EGL/GLES context because a user resolver was supplied");
414+
}
415+
else
416+
{
417+
m_loaded = false;
418+
LOG_ERROR(std::string("[GLResolver] No current GL context present: ") + reason);
419+
return false;
420+
}
410421
}
411422
}
412423

0 commit comments

Comments
 (0)