cogl/egl: Add COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT

If the EGL_KHR_no_config_context extension is supported, pass
EGL_NO_CONFIG_KHR to eglCreateContext. This will allow binding the
context to surfaces created with different configs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
This commit is contained in:
Michel Dänzer 2023-05-31 15:57:11 +02:00 committed by Marge Bot
parent dc57aa6d97
commit e437c854cd
3 changed files with 22 additions and 4 deletions

View File

@ -99,6 +99,12 @@ COGL_WINSYS_FEATURE_BEGIN (create_context,
COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT)
COGL_WINSYS_FEATURE_END ()
COGL_WINSYS_FEATURE_BEGIN (no_config_context,
"KHR\0",
"no_config_context\0",
COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT)
COGL_WINSYS_FEATURE_END ()
COGL_WINSYS_FEATURE_BEGIN (buffer_age,
"EXT\0",
"buffer_age\0",

View File

@ -101,6 +101,7 @@ typedef enum _CoglEGLWinsysFeature
COGL_EGL_WINSYS_FEATURE_FENCE_SYNC = 1L << 5,
COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT = 1L << 6,
COGL_EGL_WINSYS_FEATURE_CONTEXT_PRIORITY = 1L << 7,
COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT = 1L << 8,
} CoglEGLWinsysFeature;
typedef struct _CoglRendererEGL

View File

@ -428,10 +428,21 @@ try_create_context (CoglDisplay *display,
attribs[i++] = EGL_NONE;
if (egl_renderer->private_features &
COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT)
{
egl_display->egl_context = eglCreateContext (edpy,
EGL_NO_CONFIG_KHR,
EGL_NO_CONTEXT,
attribs);
}
else
{
egl_display->egl_context = eglCreateContext (edpy,
config,
EGL_NO_CONTEXT,
attribs);
}
if (egl_display->egl_context == EGL_NO_CONTEXT)
{