[waffle] [PATCH 4/6] egl: Add support for robust access contexts.
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Wed Apr 6 15:59:28 UTC 2016
Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
src/waffle/egl/wegl_config.c | 16 ++++++++++++++++
src/waffle/egl/wegl_context.c | 9 +++++++++
src/waffle/egl/wegl_display.c | 1 +
src/waffle/egl/wegl_display.h | 1 +
4 files changed, 27 insertions(+)
diff --git a/src/waffle/egl/wegl_config.c b/src/waffle/egl/wegl_config.c
index a79bc53..1c3f416 100644
--- a/src/waffle/egl/wegl_config.c
+++ b/src/waffle/egl/wegl_config.c
@@ -55,6 +55,22 @@ check_context_attrs(struct wegl_display *dpy,
return false;
}
+ if (attrs->context_robust && !dpy->EXT_create_context_robustness &&
+ attrs->context_api != WAFFLE_CONTEXT_OPENGL) {
+ 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,
+ "EGL_KHR_create_context is required in order to "
+ "request a robust access context for OpenGL");
+ return false;
+ }
+
switch (attrs->context_api) {
case WAFFLE_CONTEXT_OPENGL:
if (!wcore_config_attrs_version_eq(attrs, 10) && !dpy->KHR_create_context) {
diff --git a/src/waffle/egl/wegl_context.c b/src/waffle/egl/wegl_context.c
index f4ee6cd..67cbc04 100644
--- a/src/waffle/egl/wegl_context.c
+++ b/src/waffle/egl/wegl_context.c
@@ -95,6 +95,11 @@ 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) {
@@ -128,6 +133,10 @@ create_real_context(struct wegl_config *config,
assert(attrs->context_minor_version == 0);
}
+ if (attrs->context_robust) {
+ attrib_list[i++] = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT;
+ attrib_list[i++] = EGL_TRUE;
+ }
break;
default:
diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c
index 88fce7a..16af142 100644
--- a/src/waffle/egl/wegl_display.c
+++ b/src/waffle/egl/wegl_display.c
@@ -49,6 +49,7 @@ get_extensions(struct wegl_display *dpy)
// pending emission.
assert(wcore_error_get_code() == 0);
+ dpy->EXT_create_context_robustness = waffle_is_extension_in_string(extensions, "EGL_EXT_create_context_robustness");
dpy->KHR_create_context = waffle_is_extension_in_string(extensions, "EGL_KHR_create_context");
return true;
diff --git a/src/waffle/egl/wegl_display.h b/src/waffle/egl/wegl_display.h
index 43b83ef..b82a2ec 100644
--- a/src/waffle/egl/wegl_display.h
+++ b/src/waffle/egl/wegl_display.h
@@ -37,6 +37,7 @@ struct wcore_display;
struct wegl_display {
struct wcore_display wcore;
EGLDisplay egl;
+ bool EXT_create_context_robustness;
bool KHR_create_context;
};
--
2.8.0
More information about the waffle
mailing list