summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-10-15 11:08:33 +0800
committerBrian Paul <brianp@vmware.com>2009-10-15 12:53:58 -0600
commitbbfd0e26151bef567c152c8018ecc15f04c70914 (patch)
tree38db8e09a6fd2d03afebf93fd3f6ba3443e04d01 /src
parentaaa1253b09a6a38e7fcd695aa36e89b9d4bd8dfe (diff)
egl: Rework error checking in eglSwapBuffers.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/eglapi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 1d370db471..366901889f 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -31,6 +31,15 @@
*
* is generated.
*
+ * Some of the entry points use current display, context, or surface
+ * implicitly. For such entry points, the implicit objects are also
+ * checked before calling the driver function. Other than the
+ * errors listed above,
+ *
+ * EGL_BAD_CURRENT_SURFACE
+ *
+ * may also be generated.
+ *
* Notes on naming conventions:
*
* eglFooBar - public EGL function
@@ -519,7 +528,13 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
EGLBoolean EGLAPIENTRY
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
+ _EGLContext *ctx = _eglGetCurrentContext();
_EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
+
+ /* surface must be bound to current context in EGL 1.4 */
+ if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
+ return _eglError(EGL_BAD_SURFACE, __FUNCTION__);
+
return drv->API.SwapBuffers(drv, disp, surf);
}