From 48822796339cb4a55714dc3f1abbe379562ec538 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 10 Dec 2005 17:54:00 +0000 Subject: Some initial per-thread support. Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA. --- src/egl/main/eglglobals.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/egl/main/eglglobals.c') diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index a1b10c7a12..a17968e7ff 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -2,7 +2,7 @@ #include "eglglobals.h" -struct _egl_global _eglGlobal = { EGL_FALSE }; +struct _egl_global _eglGlobal = { .Initialized = EGL_FALSE }; /** @@ -17,9 +17,10 @@ _eglInitGlobals(void) _eglGlobal.Contexts = _eglNewHashTable(); _eglGlobal.Surfaces = _eglNewHashTable(); _eglGlobal.FreeScreenHandle = 1; - _eglGlobal.CurrentContext = EGL_NO_CONTEXT; - _eglGlobal.LastError = EGL_SUCCESS; _eglGlobal.Initialized = EGL_TRUE; + /* XXX temporary */ + _eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT; + _eglGlobal.ThreadInfo.LastError = EGL_SUCCESS; } } @@ -37,6 +38,18 @@ _eglDestroyGlobals(void) } +/** + * Return pointer to calling thread's _EGLThreadInfo object. + * Create a new one if needed. + * Should never return NULL. + */ +_EGLThreadInfo * +_eglGetCurrentThread(void) +{ + /* XXX temporary */ + return &_eglGlobal.ThreadInfo; +} + /** * Record EGL error code. @@ -44,10 +57,11 @@ _eglDestroyGlobals(void) void _eglError(EGLint errCode, const char *msg) { + _EGLThreadInfo *t = _eglGetCurrentThread(); const char *s; - if (_eglGlobal.LastError == EGL_SUCCESS) { - _eglGlobal.LastError = errCode; + if (t->LastError == EGL_SUCCESS) { + t->LastError = errCode; switch (errCode) { case EGL_BAD_ACCESS: -- cgit v1.2.3