android recursive mutex fix, android file path resolver fix

This commit is contained in:
2019-01-28 00:27:56 +01:00
parent 99c06803ae
commit 53fd2d60b5
6 changed files with 617 additions and 17 deletions

View File

@@ -53,6 +53,7 @@ typedef void (*fnDebugMessageCallback)(GLDEBUGPROC callback, const void* userPar
EGLDisplay g_display = EGL_NO_DISPLAY;
EGLContext g_context = EGL_NO_CONTEXT;
std::recursive_mutex mutex;
int mutex_count = 0;
jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
@@ -127,7 +128,9 @@ int GetUnicodeChar(struct android_app* app, int eventType, int keyCode, int meta
void android_async_lock(struct engine* engine)
{
mutex.lock();
eglMakeCurrent(engine->display, engine->surface, engine->surface, engine->context);
if (mutex_count == 0)
eglMakeCurrent(engine->display, engine->surface, engine->surface, engine->context);
mutex_count++;
}
void android_async_swap(struct engine* engine)
@@ -137,7 +140,9 @@ void android_async_swap(struct engine* engine)
void android_async_unlock(struct engine* engine)
{
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mutex_count--;
if (mutex_count == 0)
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mutex.unlock();
}