102e55062064d443d2300157515e9aaa8d0d5585
2 #include "eglglobals.h"
5 struct _egl_global _eglGlobal
= { EGL_FALSE
};
9 * Init the fields in the _eglGlobal struct
10 * May be safely called more than once.
15 if (!_eglGlobal
.Initialized
) {
16 _eglGlobal
.Displays
= _eglNewHashTable();
17 _eglGlobal
.Contexts
= _eglNewHashTable();
18 _eglGlobal
.Surfaces
= _eglNewHashTable();
19 _eglGlobal
.CurrentContext
= EGL_NO_CONTEXT
;
20 _eglGlobal
.LastError
= EGL_SUCCESS
;
21 _eglGlobal
.Initialized
= EGL_TRUE
;
27 * Should call this via an atexit handler.
30 _eglDestroyGlobals(void)
32 /* XXX TODO walk over table entries, deleting each */
33 _eglDeleteHashTable(_eglGlobal
.Displays
);
34 _eglDeleteHashTable(_eglGlobal
.Contexts
);
35 _eglDeleteHashTable(_eglGlobal
.Surfaces
);
41 * Record EGL error code.
44 _eglError(EGLint errCode
, const char *msg
)
46 if (_eglGlobal
.LastError
== EGL_SUCCESS
) {
47 _eglGlobal
.LastError
= errCode
;
49 fprintf(stderr
, "EGL Error 0x%x in %s\n", errCode
, msg
);