On 04/06/2016 08:59 AM, Bas Nieuwenhuizen wrote:
> Signed-off-by: Bas Nieuwenhuizen <b...@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:

Hi Bas,

This patch is correct for EGL <= 1.4. However, EGL 1.5 made
the EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT attribute (but not the flag)
legal for all OpenGL and OpenGL ES context versions.

From the EGL 1.5 (2014.08.27) spec:

    3.7.1.5 OpenGL and OpenGL ES Robust Buffer Access

    If the EGL_CONTEXT_OPENGL_ROBUST_ACCESS attribute is set to EGL_TRUE,
    a context supporting robust buffer access will be created. OpenGL contexts
    must support the GL_ARB_robustness extension, or equivalent core API
    functional- ity. OpenGL ES contexts must support the GL_EXT_robustness
    extension, or equivalent core API functionality.

    This attribute is supported only for OpenGL and OpenGL ES contexts. If the
    implementation does not support robust buffer access, context creation will
    fail.

    The default value of EGL_CONTEXT_OPENGL_ROBUST_ACCESS is EGL_ FALSE .

If you have time, please follow-up with a patch that unconditonally permits
WAFFLE_CONTEXT_ROBUST_ACCESS if the EGL version is >= 1.5.

If you don't have time, please let me know and I will find time to do it.
_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to