summaryrefslogtreecommitdiff
path: root/src/egl/main
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-10-23 16:51:01 +0800
committerChia-I Wu <olv@lunarg.com>2010-10-23 16:58:38 +0800
commit0d43cbed2f130c377bed92c7a8ad8c19f441d6a5 (patch)
treea2996422c1a3db5d0e388f1c9d0acc0df40752ed /src/egl/main
parentd19afc57fe49816f3f3290410e0124d326577be2 (diff)
egl: Fix a false negative check in _eglCheckMakeCurrent.
This call sequence eglMakeCurrent(dpy, surf, surf, ctx1); eglMakeCurrent(dpy, surf, surf, ctx2); should be valid if ctx1 and ctx2 have the same client API and are not current in another thread.
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglcontext.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 3266a75824..33dcfa6875 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -249,10 +249,6 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
if (!surfaceless && (draw == NULL || read == NULL))
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- /* context stealing from another thread is not allowed */
- if (ctx->Binding && ctx->Binding != t)
- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
-
/*
* The spec says
*
@@ -260,16 +256,23 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
* bound to contexts in another thread, an EGL_BAD_ACCESS error is
* generated."
*
- * But it also says
+ * and
*
* "at most one context may be bound to a particular surface at a given
* time"
- *
- * The latter is more restrictive so we can check only the latter case.
*/
- if ((draw && draw->CurrentContext && draw->CurrentContext != ctx) ||
- (read && read->CurrentContext && read->CurrentContext != ctx))
+ if (ctx->Binding && ctx->Binding != t)
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+ if (draw && draw->CurrentContext && draw->CurrentContext != ctx) {
+ if (draw->CurrentContext->Binding != t ||
+ draw->CurrentContext->ClientAPI != ctx->ClientAPI)
+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+ }
+ if (read && read->CurrentContext && read->CurrentContext != ctx) {
+ if (read->CurrentContext->Binding != t ||
+ read->CurrentContext->ClientAPI != ctx->ClientAPI)
+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+ }
/* simply require the configs to be equal */
if ((draw && draw->Config != ctx->Config) ||