Signed-off-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
---
 src/waffle/glx/glx_config.c  | 7 +++++++
 src/waffle/glx/glx_context.c | 4 ++++
 src/waffle/glx/glx_display.c | 1 +
 src/waffle/glx/glx_display.h | 1 +
 4 files changed, 13 insertions(+)

diff --git a/src/waffle/glx/glx_config.c b/src/waffle/glx/glx_config.c
index 7792aa0..5561e28 100644
--- a/src/waffle/glx/glx_config.c
+++ b/src/waffle/glx/glx_config.c
@@ -68,6 +68,13 @@ glx_config_check_context_attrs(struct glx_display *dpy,
         return false;
     }
 
+    if (attrs->context_robust && !dpy->ARB_create_context_robustness) {
+        wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
+                     "GLX_ARB_create_context_robustness is required in order 
to "
+                     "request a robust access context");
+        return false;
+    }
+
     switch (attrs->context_api) {
         case WAFFLE_CONTEXT_OPENGL:
             if (!wcore_config_attrs_version_eq(attrs, 10) && 
!dpy->ARB_create_context) {
diff --git a/src/waffle/glx/glx_context.c b/src/waffle/glx/glx_context.c
index 1f9290b..c6cd813 100644
--- a/src/waffle/glx/glx_context.c
+++ b/src/waffle/glx/glx_context.c
@@ -151,6 +151,10 @@ glx_context_fill_attrib_list(struct glx_config *config,
         context_flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
     }
 
+    if (attrs->context_robust) {
+        context_flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
+    }
+
     if (context_flags != 0) {
         attrib_list[i++] = GLX_CONTEXT_FLAGS_ARB;
         attrib_list[i++] = context_flags;
diff --git a/src/waffle/glx/glx_display.c b/src/waffle/glx/glx_display.c
index 24e967c..0c6851d 100644
--- a/src/waffle/glx/glx_display.c
+++ b/src/waffle/glx/glx_display.c
@@ -63,6 +63,7 @@ glx_display_set_extensions(struct glx_display *self)
 
     self->ARB_create_context                     = 
waffle_is_extension_in_string(s, "GLX_ARB_create_context");
     self->ARB_create_context_profile             = 
waffle_is_extension_in_string(s, "GLX_ARB_create_context_profile");
+    self->ARB_create_context_robustness          = 
waffle_is_extension_in_string(s, "GLX_ARB_create_context_robustness");
     self->EXT_create_context_es_profile          = 
waffle_is_extension_in_string(s, "GLX_EXT_create_context_es_profile");
 
     // The GLX_EXT_create_context_es2_profile spec, version 4 2012/03/28,
diff --git a/src/waffle/glx/glx_display.h b/src/waffle/glx/glx_display.h
index 4b8f687..b8bb875 100644
--- a/src/waffle/glx/glx_display.h
+++ b/src/waffle/glx/glx_display.h
@@ -46,6 +46,7 @@ struct glx_display {
 
     bool ARB_create_context;
     bool ARB_create_context_profile;
+    bool ARB_create_context_robustness;
     bool EXT_create_context_es_profile;
     bool EXT_create_context_es2_profile;
 };
-- 
2.8.0

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

Reply via email to