diff options
author | Yahan Zhou <yahan@google.com> | 2016-09-22 18:26:49 -0700 |
---|---|---|
committer | Yahan Zhou <yahan@google.com> | 2016-09-22 18:26:49 -0700 |
commit | d94dd8fbcfd17609214780e8e29c7aaafeb66f4e (patch) | |
tree | c91d9e723c9cedebf6d2a8084f82501bd88e8eec | |
parent | 5aabcd270bd8b8f6b9dd90c6e38b8cbf6b2ad847 (diff) | |
download | goldfish-opengl-d94dd8fbcfd17609214780e8e29c7aaafeb66f4e.tar.gz |
Fix dEQP-EGL.functional.negative_api
Fix those 2 failures:
create_pbuffer_surface
surface_attrib
We need to return the right error code for them.
Change-Id: Ie8a3ed83ed36ee7619e769546869bb12f3c2ef4e
-rw-r--r-- | system/egl/egl.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp index cc7e2adf..306b840e 100644 --- a/system/egl/egl.cpp +++ b/system/egl/egl.cpp @@ -813,9 +813,11 @@ EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLin switch (attrib_list[0]) { case EGL_WIDTH: w = attrib_list[1]; + if (w < 0) setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE); break; case EGL_HEIGHT: h = attrib_list[1]; + if (h < 0) setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE); break; case EGL_TEXTURE_FORMAT: texFormat = attrib_list[1]; @@ -823,8 +825,14 @@ EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLin case EGL_TEXTURE_TARGET: texTarget = attrib_list[1]; break; - default: + // the followings are not supported + case EGL_LARGEST_PBUFFER: + case EGL_MIPMAP_TEXTURE: + case EGL_VG_ALPHA_FORMAT: + case EGL_VG_COLORSPACE: break; + default: + setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE); }; attrib_list+=2; } @@ -1067,14 +1075,36 @@ EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute (void)value; + egl_surface_t* p_surface( static_cast<egl_surface_t*>(surface) ); switch (attribute) { case EGL_MIPMAP_LEVEL: + return true; + break; case EGL_MULTISAMPLE_RESOLVE: + { + if (value == EGL_MULTISAMPLE_RESOLVE_BOX) { + EGLint surface_type; + s_display.getConfigAttrib(p_surface->config, EGL_SURFACE_TYPE, &surface_type); + if (0 == (surface_type & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)) { + setErrorReturn(EGL_BAD_MATCH, EGL_FALSE); + } + } + return true; + break; + } case EGL_SWAP_BEHAVIOR: + if (value == EGL_BUFFER_PRESERVED) { + EGLint surface_type; + s_display.getConfigAttrib(p_surface->config, EGL_SURFACE_TYPE, &surface_type); + if (0 == (surface_type & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)) { + setErrorReturn(EGL_BAD_MATCH, EGL_FALSE); + } + } return true; break; default: ALOGW("%s: attr=0x%x not implemented", __FUNCTION__, attribute); + setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE); } return false; } |