diff options
author | Mathias Agopian <mathias@google.com> | 2009-10-28 21:00:29 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-10-29 16:45:41 -0700 |
commit | f007a2faa1d765e9b53553a8214179b253e3cbbd (patch) | |
tree | 7928e89551e22c634ab697673072128e2a2444ff /opengl/libs | |
parent | ec1f1e3df1ca5e73e262df479bf91a92f3ccafde (diff) | |
download | frameworks_base-f007a2faa1d765e9b53553a8214179b253e3cbbd.zip frameworks_base-f007a2faa1d765e9b53553a8214179b253e3cbbd.tar.gz frameworks_base-f007a2faa1d765e9b53553a8214179b253e3cbbd.tar.bz2 |
return proper error code from eglCreateImageKHR
Diffstat (limited to 'opengl/libs')
-rw-r--r-- | opengl/libs/EGL/egl.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index 3efb678..5efecb0 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -1641,8 +1641,13 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, if (dp == 0) { return setError(EGL_BAD_DISPLAY, EGL_NO_IMAGE_KHR); } - // since we don't have a way to know which implementation to call, - // we're calling all of them + + /* Since we don't have a way to know which implementation to call, + * we're calling all of them. If at least one of the implementation + * succeeded, this is a success. + */ + + EGLint currentError = eglGetError(); EGLImageKHR implImages[IMPL_NUM_IMPLEMENTATIONS]; bool success = false; @@ -1659,9 +1664,24 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, } } } - if (!success) + + if (!success) { + // failure, if there was an error when we entered this function, + // the error flag must not be updated. + // Otherwise, the error is whatever happened in the implementation + // that faulted. + if (currentError != EGL_SUCCESS) { + setError(currentError, EGL_NO_IMAGE_KHR); + } return EGL_NO_IMAGE_KHR; - + } else { + // In case of success, we need to clear all error flags + // (especially those caused by the implementation that didn't + // succeed). TODO: we could about this if we knew this was + // a "full" success (all implementation succeeded). + eglGetError(); + } + egl_image_t* result = new egl_image_t(dpy, ctx); memcpy(result->images, implImages, sizeof(implImages)); return (EGLImageKHR)result; |