egl: Use a boolean to indicate whether a resource is linked.
An unlinked resource may still be a current resource such as current surfaces. There might still be a need to know which display the unlinked resource belongs to.
This commit is contained in:
@@ -242,7 +242,10 @@ _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
|
|||||||
void
|
void
|
||||||
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
|
_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
|
||||||
{
|
{
|
||||||
|
assert(!res->Display || res->Display == dpy);
|
||||||
|
|
||||||
res->Display = dpy;
|
res->Display = dpy;
|
||||||
|
res->IsLinked = EGL_TRUE;
|
||||||
res->Next = dpy->ResourceLists[type];
|
res->Next = dpy->ResourceLists[type];
|
||||||
dpy->ResourceLists[type] = res;
|
dpy->ResourceLists[type] = res;
|
||||||
}
|
}
|
||||||
@@ -271,5 +274,6 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
res->Next = NULL;
|
res->Next = NULL;
|
||||||
res->Display = NULL;
|
/* do not reset res->Display */
|
||||||
|
res->IsLinked = EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,11 @@ enum _egl_resource_type {
|
|||||||
*/
|
*/
|
||||||
struct _egl_resource
|
struct _egl_resource
|
||||||
{
|
{
|
||||||
|
/* which display the resource belongs to */
|
||||||
_EGLDisplay *Display;
|
_EGLDisplay *Display;
|
||||||
|
EGLBoolean IsLinked;
|
||||||
|
|
||||||
|
/* used to link resources of the same type */
|
||||||
_EGLResource *Next;
|
_EGLResource *Next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -179,7 +183,7 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
|
|||||||
static INLINE EGLBoolean
|
static INLINE EGLBoolean
|
||||||
_eglIsResourceLinked(_EGLResource *res)
|
_eglIsResourceLinked(_EGLResource *res)
|
||||||
{
|
{
|
||||||
return (res->Display != NULL);
|
return res->IsLinked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user