[waffle] [PATCH 3/6] wgl: Add support for robust access contexts.
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Wed Apr 6 15:59:27 UTC 2016
Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
src/waffle/wgl/wgl_config.c | 7 +++++++
src/waffle/wgl/wgl_context.c | 4 ++++
src/waffle/wgl/wgl_display.c | 1 +
src/waffle/wgl/wgl_display.h | 1 +
4 files changed, 13 insertions(+)
diff --git a/src/waffle/wgl/wgl_config.c b/src/waffle/wgl/wgl_config.c
index 59a70a6..80d45fc 100644
--- a/src/waffle/wgl/wgl_config.c
+++ b/src/waffle/wgl/wgl_config.c
@@ -71,6 +71,13 @@ wgl_config_check_context_attrs(struct wgl_display *dpy,
return false;
}
+ if (attrs->context_robust && !dpy->ARB_create_context_robustness) {
+ wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM,
+ "WGL_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/wgl/wgl_context.c b/src/waffle/wgl/wgl_context.c
index dd45f81..c7a351f 100644
--- a/src/waffle/wgl/wgl_context.c
+++ b/src/waffle/wgl/wgl_context.c
@@ -135,6 +135,10 @@ wgl_context_fill_attrib_list(struct wgl_config *config,
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
}
+ if (attrs->context_robust) {
+ context_flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB;
+ }
+
if (context_flags != 0) {
attrib_list[i++] = WGL_CONTEXT_FLAGS_ARB;
attrib_list[i++] = context_flags;
diff --git a/src/waffle/wgl/wgl_display.c b/src/waffle/wgl/wgl_display.c
index 9b3b38e..c0b547a 100644
--- a/src/waffle/wgl/wgl_display.c
+++ b/src/waffle/wgl/wgl_display.c
@@ -153,6 +153,7 @@ wgl_display_set_extensions(struct wgl_display *dpy)
dpy->ARB_create_context = waffle_is_extension_in_string(extensions, "WGL_ARB_create_context");
dpy->ARB_create_context_profile = waffle_is_extension_in_string(extensions, "WGL_ARB_create_context_profile");
+ dpy->ARB_create_context_robustness = waffle_is_extension_in_string(extensions, "WGL_ARB_create_context_robustness");
dpy->EXT_create_context_es_profile = waffle_is_extension_in_string(extensions, "WGL_EXT_create_context_es_profile");
// The WGL_EXT_create_context_es2_profile spec, version 5 2012/04/06,
diff --git a/src/waffle/wgl/wgl_display.h b/src/waffle/wgl/wgl_display.h
index d0d94fe..c8dfb81 100644
--- a/src/waffle/wgl/wgl_display.h
+++ b/src/waffle/wgl/wgl_display.h
@@ -55,6 +55,7 @@ struct wgl_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;
bool ARB_pixel_format;
--
2.8.0
More information about the waffle
mailing list