On Thu, Aug 13, 2009 at 11:51:19AM -0600, Brian Paul wrote:
> I seem to recall that an earlier version of EGL defined EGLContext,
> EGLSurface, etc. as ints. But since they're pointers now, we should
> get rid of the hash table/lookups.
Another reason for treating EGLSurface and the likes as hash keys is
that invalid keys can always be detected.
The only EGL impl I have to reference is from OpenVG reference impl. It
simply casts its internal data structure to EGLSurface when creating a
surface. But, it uses an array to store _all_ surfaces it has created.
For each EGLSurface passed in, it loops over that array to make sure the
EGLSurface is in the array.
That said, I prefer simple casting too. I would rather see my app
segfault when I pass something really bad to EGL than having EGL set
EGL_BAD_CONTEXT that I do not check.
Actually, the sole user of the hash table now is egldisplay.c. It is
also where _eglLookupSomething is defined. It should be fairly easy
ifdef the related code in egldisplay.c and switch lookup functions to,
say,
static INLINE _EGLSurface *
_eglLookupSurface(EGLSurface surf, _EGLDisplay *dpy)
{
#if _EGL_HAVE_HASH
EGLuint key = _eglPointerToUInt((void *) surf);
return (_EGLSurface *) _eglHashLookup(dpy->SurfaceHash, key);
#else
_EGLSurface *s = (_EGLSurface *) surf;
return (s && s->Display == dpy) ? s : NULL;
#endif
}
The rest of EGL does not need to change at all.
--
Regards,
olv
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev