egl: Account for default values of texture target and format
authorPlamena Manolova <plamena.manolova@intel.com>
Wed, 1 Jun 2016 16:31:29 +0000 (17:31 +0100)
committerAnuj Phogat <anuj.phogat@gmail.com>
Thu, 2 Jun 2016 23:07:31 +0000 (16:07 -0700)
When validating attributes during surface creation we should account
for the default values of texture target and format (EGL_NO_TEXTURE)
since the user is not obligated to explicitly set both via the
attribute list passed to eglCreatePbufferSurface.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/egl/main/eglsurface.c

index 17d79077837a01ef53654e0942f0d9ecacac3334..99e24dd88956bfa3efb065f5e0cb2b522e5ed35f 100644 (file)
@@ -236,6 +236,12 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
       }
 
       if (type == EGL_PBUFFER_BIT) {
+         if (tex_target == -1)
+            tex_target = surf->TextureTarget;
+
+         if (tex_format == -1)
+            tex_format = surf->TextureFormat;
+
          if ((tex_target == EGL_NO_TEXTURE && tex_format != EGL_NO_TEXTURE) ||
              (tex_format == EGL_NO_TEXTURE && tex_target != EGL_NO_TEXTURE)) {
             err = EGL_BAD_MATCH;