The EXT_create_context_robustness extension covers only GLES contexts,
while the latter EGL_KHR_create_context works for both GL and GLES ones.

Cc: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com>
---

Seems like these lovely extensions managed to confused most of us.
Although in all honestly, chances are pretty small that one will 
implement the KHR extension and no the EXT one and vice-versa.

Emil

 src/waffle/egl/wegl_config.c  | 12 +++---------
 src/waffle/egl/wegl_context.c | 11 +++++------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/waffle/egl/wegl_config.c b/src/waffle/egl/wegl_config.c
index 1c3f416..9e0bc2e 100644
--- a/src/waffle/egl/wegl_config.c
+++ b/src/waffle/egl/wegl_config.c
@@ -56,18 +56,12 @@ check_context_attrs(struct wegl_display *dpy,
     }
 
     if (attrs->context_robust && !dpy->EXT_create_context_robustness &&
-        attrs->context_api != WAFFLE_CONTEXT_OPENGL) {
+        attrs->context_api != WAFFLE_CONTEXT_OPENGL && 
!dpy->KHR_create_context) {
         wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
                      "EGL_EXT_create_context_robustness is required in order 
to "
-                     "request a robust access context for OpenGL ES");
-        return false;
-    }
-
-    if (attrs->context_robust && !dpy->KHR_create_context &&
-        attrs->context_api == WAFFLE_CONTEXT_OPENGL) {
-        wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
+                     "request a robust access context for OpenGL ES."
                      "EGL_KHR_create_context is required in order to "
-                     "request a robust access context for OpenGL");
+                     "request a robust access context for OpenGL or OpenGL 
ES");
         return false;
     }
 
diff --git a/src/waffle/egl/wegl_context.c b/src/waffle/egl/wegl_context.c
index 67cbc04..027ed97 100644
--- a/src/waffle/egl/wegl_context.c
+++ b/src/waffle/egl/wegl_context.c
@@ -77,6 +77,10 @@ create_real_context(struct wegl_config *config,
         context_flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
     }
 
+    if (attrs->context_robust && dpy->KHR_create_context) {
+        context_flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
+    }
+
     switch (waffle_context_api) {
         case WAFFLE_CONTEXT_OPENGL:
             if (dpy->KHR_create_context) {
@@ -95,11 +99,6 @@ create_real_context(struct wegl_config *config,
                 context_flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
             }
 
-            if (attrs->context_robust) {
-                assert(dpy->KHR_create_context);
-                context_flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
-            }
-
             if (wcore_config_attrs_version_ge(attrs, 32))  {
                 assert(dpy->KHR_create_context);
                 switch (attrs->context_profile) {
@@ -133,7 +132,7 @@ create_real_context(struct wegl_config *config,
                 assert(attrs->context_minor_version == 0);
             }
 
-            if (attrs->context_robust) {
+            if (attrs->context_robust && EXT_create_context_robustness) {
                 attrib_list[i++] = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT;
                 attrib_list[i++] = EGL_TRUE;
             }
-- 
2.8.0

_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to