Update egl_context.c

- Knowing the thread id greatly simplifies debugging.
- The return value of eglMakeCurrent should be checked.
This commit is contained in:
Yousry Abdallah 2016-01-05 11:03:36 +01:00
parent d2d57c70e2
commit c6ec66ed9e

View File

@ -30,7 +30,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/syscall.h>
// Return a description of the specified EGL error
//
@ -564,21 +565,34 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWctxconfig* ctxconfig,
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
{
int tid = syscall(SYS_gettid);
EGLBoolean ok = 1;
if (window)
{
eglMakeCurrent(_glfw.egl.display,
printf("----> [glfw]_glfwPlatformMakeContextCurrent With window called (TID: %d).\n", tid);
ok = eglMakeCurrent(_glfw.egl.display,
window->context.egl.surface,
window->context.egl.surface,
window->context.egl.handle);
}
else
{
eglMakeCurrent(_glfw.egl.display,
printf("----> [glfw]_glfwPlatformMakeContextCurrent empty (TID: %d).\n", tid);
ok = eglMakeCurrent(_glfw.egl.display,
EGL_NO_SURFACE,
EGL_NO_SURFACE,
EGL_NO_CONTEXT);
}
if(ok == 0) {
printf("----> [glfw] _glfwPlatformMakeContextCurrent failed.\n");
int errCode = eglGetError();
printf("----> [glfw] Error Code: %0x\n", errCode);
abort();
}
_glfwPlatformSetCurrentContext(window);
}