diff options
author | Chia-I Wu <[email protected]> | 2010-10-23 12:52:26 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-10-23 15:26:28 +0800 |
commit | d19afc57fe49816f3f3290410e0124d326577be2 (patch) | |
tree | 8d90c500c91f8c2e703a05259c85406d4261c3ed /src/egl/main/eglapi.c | |
parent | dc4f845c37a8446de19036e24fd397a0aa864c02 (diff) |
egl: Use reference counting to replace IsLinked or IsBound.
Remove all _egl<Res>IsLinked and _egl<Res>IsBound. Update
_eglBindContext and drivers to do reference counting.
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r-- | src/egl/main/eglapi.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 913ddd288bd..efa9e97346b 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -648,11 +648,12 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval) _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); - if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + ctx->Resource.Display != disp) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); surf = ctx->DrawSurface; - if (!_eglIsSurfaceLinked(surf)) + if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapInterval(drv, disp, surf, interval); @@ -673,7 +674,8 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); /* surface must be bound to current context in EGL 1.4 */ - if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapBuffers(drv, disp, surf); @@ -714,7 +716,8 @@ eglWaitClient(void) _eglLockMutex(&disp->Mutex); /* let bad current context imply bad current surface */ - if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + _eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); /* a valid current context implies an initialized current display */ @@ -763,7 +766,8 @@ eglWaitNative(EGLint engine) _eglLockMutex(&disp->Mutex); /* let bad current context imply bad current surface */ - if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + _eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); /* a valid current context implies an initialized current display */ @@ -1437,7 +1441,8 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, RETURN_EGL_EVAL(disp, EGL_FALSE); /* surface must be bound to current context in EGL 1.4 */ - if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) + if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || + surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); |