Re: [waffle] [PATCH 6/6] nacl: Add an error when trying to use a robust access context.
This looks correct to me; Reviewed-by: Tapani Pälli Note that following patch is required to build waffle nacl support on any recent nacl sdk versions: https://lists.freedesktop.org/archives/waffle/2015-October/001266.html On 04/06/2016 06:59 PM, Bas Nieuwenhuizen wrote: Signed-off-by: Bas Nieuwenhuizen --- src/waffle/nacl/nacl_config.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c index 9017775..668657b 100644 --- a/src/waffle/nacl/nacl_config.c +++ b/src/waffle/nacl/nacl_config.c @@ -63,6 +63,12 @@ nacl_config_choose(struct wcore_platform *wc_plat, goto error; } +if (attrs->context_robust) { +wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, + "NaCl does not support robust contexts."); +goto error; +} + unsigned attr = 0; // Max amount of attribs is hardcoded in nacl_config.h (64) ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
Re: [waffle] [PATCH] cmake: use the EGL CFLAGS in the waffle CFLAGS
On 02/11/2016 03:21 PM, Mircea Gherzan wrote: > Without them, the build will fail with a recent Mesa from the master > branch on a system without the X headers: > > include/EGL/eglplatform.h:119:22: fatal error: X11/Xlib.h: No such file > or directory > > Signed-off-by: Mircea Gherzan Yes, because egl_CFLAGS_OTHER contains -DMESA_EGL_NO_X11_HEADERS when the system has no X headers. Thanks. Patch is pushed to master. ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] I'm back from paternity leave
Hi everyone, I abruptly left for paternity leave in early February, and now I'm a father! My little boy is named Lucas, and he's incredible. While on leave, I had little time to spare for non-baby activities, so it's been over two months since I read any code-related mail. I returned from paternity leave yesterday, and am now catching up on unread Waffle mail. ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 5/6] cgl: Add an error when trying to use a robust access context.
Signed-off-by: Bas Nieuwenhuizen --- src/waffle/cgl/cgl_config.m | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/waffle/cgl/cgl_config.m b/src/waffle/cgl/cgl_config.m index d7e8ed3..898ee24 100644 --- a/src/waffle/cgl/cgl_config.m +++ b/src/waffle/cgl/cgl_config.m @@ -82,6 +82,12 @@ cgl_config_check_attrs(const struct cgl_platform *plat, return false; } +if (attrs->context_robust) { +wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, + "CGL does not support robust contexts"); +return false; +} + // Emulate EGL_KHR_create_context, which allows the implementation to // return a context of the latest supported flavor that is // backwards-compatibile with the requested flavor. -- 2.8.0 ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 3/6] wgl: Add support for robust access contexts.
Signed-off-by: Bas Nieuwenhuizen --- 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 ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 4/6] egl: Add support for robust access contexts.
Signed-off-by: Bas Nieuwenhuizen --- 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 ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 1/6] wcore: Add support for robust access contexts.
Signed-off-by: Bas Nieuwenhuizen --- include/waffle/waffle.h | 4 man/waffle_config.3.xml | 24 src/waffle/core/wcore_config_attrs.c | 3 +++ src/waffle/core/wcore_config_attrs.h | 1 + src/waffle/core/wcore_util.c | 1 + 5 files changed, 33 insertions(+) diff --git a/include/waffle/waffle.h b/include/waffle/waffle.h index df0218e..b207f37 100644 --- a/include/waffle/waffle.h +++ b/include/waffle/waffle.h @@ -142,6 +142,10 @@ enum waffle_enum { WAFFLE_CONTEXT_DEBUG= 0x0216, #endif +#if WAFFLE_API_VERSION >= 0x106 +WAFFLE_CONTEXT_ROBUST_ACCESS= 0x0217, +#endif + WAFFLE_RED_SIZE = 0x0201, WAFFLE_GREEN_SIZE = 0x0202, WAFFLE_BLUE_SIZE= 0x0203, diff --git a/man/waffle_config.3.xml b/man/waffle_config.3.xml index a8cb98d..b8ae67a 100644 --- a/man/waffle_config.3.xml +++ b/man/waffle_config.3.xml @@ -412,6 +412,30 @@ struct waffle_config; +WAFFLE_CONTEXT_ROBUST_ACCESS + + +Feature test macro: WAFFLE_API_VERSION >= 0x0106. +(See waffle_feature_test_macros7). + + +This attribute, if true, instructs + waffle_context_create3 +to create a robust access context. + + +Robust access contexts can implement additional runtime checks, such as bounds checks for various +operations. + + +This attribute is optional and its default value is false(0). + +Valid values are true(1), false(0), and WAFFLE_DONT_CARE. + + + + + WAFFLE_RED_SIZE WAFFLE_GREEN_SIZE WAFFLE_BLUE_SIZE diff --git a/src/waffle/core/wcore_config_attrs.c b/src/waffle/core/wcore_config_attrs.c index 4a2cb5d..9caa0cc 100644 --- a/src/waffle/core/wcore_config_attrs.c +++ b/src/waffle/core/wcore_config_attrs.c @@ -54,6 +54,7 @@ check_keys(const int32_t attrib_list[]) case WAFFLE_CONTEXT_PROFILE: case WAFFLE_CONTEXT_FORWARD_COMPATIBLE: case WAFFLE_CONTEXT_DEBUG: +case WAFFLE_CONTEXT_ROBUST_ACCESS: case WAFFLE_RED_SIZE: case WAFFLE_GREEN_SIZE: case WAFFLE_BLUE_SIZE: @@ -339,6 +340,7 @@ set_misc_defaults(struct wcore_config_attrs *attrs) // [2] EGL 1.4 spec (2011.04.06), Table 3.4 attrs->context_debug= false; +attrs->context_robust = false; attrs->rgba_size= 0; attrs->red_size = 0; @@ -414,6 +416,7 @@ parse_misc(struct wcore_config_attrs *attrs, CASE_INT(WAFFLE_SAMPLES, samples) CASE_BOOL(WAFFLE_CONTEXT_DEBUG, context_debug, false); +CASE_BOOL(WAFFLE_CONTEXT_ROBUST_ACCESS, context_robust, false); CASE_BOOL(WAFFLE_SAMPLE_BUFFERS, sample_buffers, DEFAULT_SAMPLE_BUFFERS); CASE_BOOL(WAFFLE_DOUBLE_BUFFERED, double_buffered, DEFAULT_DOUBLE_BUFFERED); CASE_BOOL(WAFFLE_ACCUM_BUFFER, accum_buffer, DEFAULT_ACCUM_BUFFER); diff --git a/src/waffle/core/wcore_config_attrs.h b/src/waffle/core/wcore_config_attrs.h index cca5e8b..e00e517 100644 --- a/src/waffle/core/wcore_config_attrs.h +++ b/src/waffle/core/wcore_config_attrs.h @@ -54,6 +54,7 @@ struct wcore_config_attrs { bool context_forward_compatible; bool context_debug; +bool context_robust; bool double_buffered; bool sample_buffers; bool accum_buffer; diff --git a/src/waffle/core/wcore_util.c b/src/waffle/core/wcore_util.c index c563fae..4c09164 100644 --- a/src/waffle/core/wcore_util.c +++ b/src/waffle/core/wcore_util.c @@ -97,6 +97,7 @@ wcore_enum_to_string(int32_t e) CASE(WAFFLE_CONTEXT_COMPATIBILITY_PROFILE); CASE(WAFFLE_CONTEXT_FORWARD_COMPATIBLE); CASE(WAFFLE_CONTEXT_DEBUG); +CASE(WAFFLE_CONTEXT_ROBUST_ACCESS); CASE(WAFFLE_RED_SIZE); CASE(WAFFLE_GREEN_SIZE); CASE(WAFFLE_BLUE_SIZE); -- 2.8.0 ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 6/6] nacl: Add an error when trying to use a robust access context.
Signed-off-by: Bas Nieuwenhuizen --- src/waffle/nacl/nacl_config.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/waffle/nacl/nacl_config.c b/src/waffle/nacl/nacl_config.c index 9017775..668657b 100644 --- a/src/waffle/nacl/nacl_config.c +++ b/src/waffle/nacl/nacl_config.c @@ -63,6 +63,12 @@ nacl_config_choose(struct wcore_platform *wc_plat, goto error; } +if (attrs->context_robust) { +wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, + "NaCl does not support robust contexts."); +goto error; +} + unsigned attr = 0; // Max amount of attribs is hardcoded in nacl_config.h (64) -- 2.8.0 ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
[waffle] [PATCH 2/6] glx: Add support for robust access contexts.
Signed-off-by: Bas Nieuwenhuizen --- 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
Re: [waffle] [PATCH 01/29] wayland: add wl_proxy_create wrapper
On 6 January 2016 at 21:27, Emil Velikov wrote: > libwayland has broken its ABI by replacing wl_proxy_create + > wl_proxy_marshal with wfl_wl_proxy_marshal_constructor with commit > 853c24e6998(client: Introduce functions to allocate and marshal proxies > atomically). > > Add the wrapper to keep compatibility with wayland 1.3.90 and earlier. > > Signed-off-by: Emil Velikov > --- > src/waffle/wayland/wayland_wrapper.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/src/waffle/wayland/wayland_wrapper.h > b/src/waffle/wayland/wayland_wrapper.h > index 40a581a..e2c96ca 100644 > --- a/src/waffle/wayland/wayland_wrapper.h > +++ b/src/waffle/wayland/wayland_wrapper.h > @@ -66,6 +66,10 @@ int > (*wfl_wl_proxy_add_listener)(struct wl_proxy *proxy, > void (**implementation)(void), void *data); > > +struct wl_proxy * > +(*wfl_wl_proxy_create)(struct wl_proxy *factory, > + const struct wl_interface *interface); > + > void > (*wfl_wl_proxy_marshal)(struct wl_proxy *p, uint32_t opcode, ...); > > @@ -90,5 +94,6 @@ struct wl_proxy * > #define wl_display_roundtrip (*wfl_wl_display_roundtrip) > #define wl_proxy_destroy (*wfl_wl_proxy_destroy) > #define wl_proxy_add_listener (*wfl_wl_proxy_add_listener) > +#define wl_proxy_create (*wfl_wl_proxy_create) > #define wl_proxy_marshal (*wfl_wl_proxy_marshal) > #define wl_proxy_marshal_constructor (*wfl_wl_proxy_marshal_constructor) A small note I had lying around - XXX: Double check that it works (might need the following hunk). diff --git a/src/waffle/wayland/wayland_wrapper.c b/src/waffle/wayland/wayland_wrapper.c index 6ffd5a9..729f860 100644 --- a/src/waffle/wayland/wayland_wrapper.c +++ b/src/waffle/wayland/wayland_wrapper.c @@ -104,6 +104,7 @@ wayland_wrapper_init(void) RETRIEVE_WL_CLIENT_SYMBOL(wl_display_roundtrip); RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_destroy); RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener); +RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_create); RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal); RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor); #undef RETRIEVE_WL_CLIENT_SYMBOL -Emil ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle
Re: [waffle] [PATCH 1/3] glx: don't use ARB_create_context with pre 3.0 contexts
On 05/04/16 22:45, Emil Velikov wrote: This way if the user requests GL pre 3.0 context which lacks the flags/extra bits which require ARB_create_context one can safely fall back to the normal/legacy entry point. This resolves piglits on non 3.0 capable drivers such as classic swrast, nouveau_vieux and alike. Cc: Jose Fonseca Cc: Ilia Mirkin Signed-off-by: Emil Velikov --- src/waffle/glx/glx_config.c | 7 --- src/waffle/glx/glx_context.c | 12 +++- src/waffle/glx/glx_context.h | 16 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/waffle/glx/glx_config.c b/src/waffle/glx/glx_config.c index 7792aa0..5d02bc3 100644 --- a/src/waffle/glx/glx_config.c +++ b/src/waffle/glx/glx_config.c @@ -32,6 +32,7 @@ #include "wcore_error.h" #include "glx_config.h" +#include "glx_context.h" #include "glx_display.h" #include "glx_platform.h" #include "glx_wrappers.h" @@ -70,11 +71,11 @@ glx_config_check_context_attrs(struct glx_display *dpy, switch (attrs->context_api) { case WAFFLE_CONTEXT_OPENGL: -if (!wcore_config_attrs_version_eq(attrs, 10) && !dpy->ARB_create_context) { +if (glx_context_needs_arb_create_context(attrs) && +!dpy->ARB_create_context) { wcore_errorf(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM, "GLX_ARB_create_context is required in order to " - "request an OpenGL version not equal to the default " - "value 1.0"); + "request an OpenGL version greater or equal than 3.0"); return false; } else if (wcore_config_attrs_version_ge(attrs, 32) && !dpy->ARB_create_context_profile) { diff --git a/src/waffle/glx/glx_context.c b/src/waffle/glx/glx_context.c index 1f9290b..8d532d3 100644 --- a/src/waffle/glx/glx_context.c +++ b/src/waffle/glx/glx_context.c @@ -169,7 +169,17 @@ glx_context_create_native(struct glx_config *config, struct glx_display *dpy = glx_display(config->wcore.display); struct glx_platform *platform = glx_platform(dpy->wcore.platform); -if (dpy->ARB_create_context) { +// Use ARB_create_context when we have +// - OpenGL version 1.0, or +// - OpenGL version 3.0 or greater, or +// - OpenGL with fwd_compat, or +// - Debug context +// +// The first one of the four is optional, the remainder hard requirement +// for the use of ARB_create_context. +if (dpy->ARB_create_context && +(wcore_config_attrs_version_eq(&config->wcore.attrs, 10) || + glx_context_needs_arb_create_context(&config->wcore.attrs))) { bool ok; // Choose a large size to prevent accidental overflow. diff --git a/src/waffle/glx/glx_context.h b/src/waffle/glx/glx_context.h index bb2a4dd..b471b0e 100644 --- a/src/waffle/glx/glx_context.h +++ b/src/waffle/glx/glx_context.h @@ -29,6 +29,7 @@ #include +#include "wcore_config_attrs.h" #include "wcore_context.h" #include "wcore_util.h" @@ -55,3 +56,18 @@ glx_context_destroy(struct wcore_context *wc_self); union waffle_native_context* glx_context_get_native(struct wcore_context *wc_self); + + +static inline bool +glx_context_needs_arb_create_context(const struct wcore_config_attrs *attrs) +{ +if (attrs->context_api == WAFFLE_CONTEXT_OPENGL && +(wcore_config_attrs_version_ge(attrs, 30) || + attrs->context_forward_compatible)) +return true; + +if (attrs->context_debug) +return true; + +return false; +} Looks good to me. Thanks. Reviewed-by: Jose Fonseca ___ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle