egl: add check that eglCreateContext gets a valid config
authorTapani Pälli <tapani.palli@intel.com>
Thu, 20 Oct 2016 11:11:16 +0000 (14:11 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 25 Oct 2016 04:24:11 +0000 (07:24 +0300)
Fixes following dEQP test:

   dEQP-EGL.functional.negative_api.create_context

v2: don't break EGL_KHR_no_config_context (Eric Engestrom)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
src/egl/main/eglapi.c

index d8bd76dd12c3816e1c67eb6fd4a2baa8fa4e3c84..9db9964beee2bada4a1a1150745527e1f1e4d7cd 100644 (file)
@@ -734,7 +734,9 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
 
    _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
 
-   if (!config && !disp->Extensions.KHR_no_config_context)
+   if (config != EGL_NO_CONFIG_KHR)
+      _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
+   else if (!disp->Extensions.KHR_no_config_context)
       RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
 
    if (!share && share_list != EGL_NO_CONTEXT)