diff options
author | Chad Versace <[email protected]> | 2013-05-06 07:41:11 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2013-05-08 08:44:05 -0700 |
commit | 2878f4685c8a5165937b5f4510b602d1a67af055 (patch) | |
tree | 701fcde102963519d6bb404f1e0791a381da0a06 /src/egl/drivers | |
parent | 38d2a16c0113b905c46804695c4fafd1b5865d08 (diff) |
egl/android: Fix error condition for EGL_ANDROID_image_native_buffer
Emit EGL_BAD_CONTEXT if the user passes a context to
eglCreateImageKHR(type=EGL_ANDROID_image_native_buffer).
From the EGL_ANDROID_image_native_buffer spec:
* If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not
EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated.
Note: This is a candidate for the stable branches.
Reviewed-by: Tapani Pälli <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/platform_android.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 3432f18b047..70aaf506b4a 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -334,7 +334,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) } static _EGLImage * -dri2_create_image_android_native_buffer(_EGLDisplay *disp, +dri2_create_image_android_native_buffer(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); @@ -342,6 +342,18 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp, int name; EGLint format; + if (ctx != NULL) { + /* From the EGL_ANDROID_image_native_buffer spec: + * + * * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not + * EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. + */ + _eglError(EGL_BAD_CONTEXT, "eglCreateEGLImageKHR: for " + "EGL_NATIVE_BUFFER_ANDROID, the context must be " + "EGL_NO_CONTEXT"); + return NULL; + } + if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC || buf->common.version != sizeof(*buf)) { _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); @@ -413,7 +425,7 @@ droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, { switch (target) { case EGL_NATIVE_BUFFER_ANDROID: - return dri2_create_image_android_native_buffer(disp, + return dri2_create_image_android_native_buffer(disp, ctx, (struct ANativeWindowBuffer *) buffer); default: return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); |