summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglglobals.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-12-10 17:54:00 +0000
committerBrian Paul <[email protected]>2005-12-10 17:54:00 +0000
commit48822796339cb4a55714dc3f1abbe379562ec538 (patch)
tree83a6ab54af6a26242b0176f82d67c7c0e66ff776 /src/egl/main/eglglobals.c
parentb04dd5c58763039a564c50b5e3c0bbc9755e7f72 (diff)
Some initial per-thread support.
Rename eglShowSurfaceMESA to eglShowScreenSurfaceMESA.
Diffstat (limited to 'src/egl/main/eglglobals.c')
-rw-r--r--src/egl/main/eglglobals.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index a1b10c7a12f..a17968e7ff2 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: