From 3aa4f3a4425aa29bf72ab74528d74bac19bdc994 Mon Sep 17 00:00:00 2001 From: Heinrich Fink Date: Tue, 30 Jul 2019 15:58:20 +0200 Subject: [PATCH] egl: Add GL_MESA_EGL_sync support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit follow OES_EGL_sync to universially enable use of EGL sync objects with desktop OpenGL contexts. Reviewed-by: Daniel Stone Reviewed-by: Marek Olšák --- src/egl/main/eglapi.c | 11 +++++++---- src/mesa/main/extensions_table.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 0cd17cebf03..bed4ddced68 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1851,9 +1851,10 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list, (type == EGL_SYNC_FENCE_KHR || type == EGL_SYNC_NATIVE_FENCE_ANDROID)) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR); - /* return an error if the client API doesn't support GL_OES_EGL_sync */ + /* return an error if the client API doesn't support GL_[OES|MESA]_EGL_sync. */ if (ctx && (ctx->Resource.Display != disp || - ctx->ClientAPI != EGL_OPENGL_ES_API)) + (ctx->ClientAPI != EGL_OPENGL_ES_API && + ctx->ClientAPI != EGL_OPENGL_API))) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR); switch (type) { @@ -2035,8 +2036,10 @@ _eglWaitSyncCommon(_EGLDisplay *disp, _EGLSync *s, EGLint flags) _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); assert(disp->Extensions.KHR_wait_sync); - /* return an error if the client API doesn't support GL_OES_EGL_sync */ - if (ctx == EGL_NO_CONTEXT || ctx->ClientAPI != EGL_OPENGL_ES_API) + /* return an error if the client API doesn't support GL_[OES|MESA]_EGL_sync. */ + if (ctx == EGL_NO_CONTEXT || + (ctx->ClientAPI != EGL_OPENGL_ES_API && + ctx->ClientAPI != EGL_OPENGL_API)) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE); /* the API doesn't allow any flags yet */ diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 3f313db870d..8377f3ed936 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -354,6 +354,7 @@ EXT(KHR_texture_compression_astc_hdr , KHR_texture_compression_astc_hdr EXT(KHR_texture_compression_astc_ldr , KHR_texture_compression_astc_ldr , GLL, GLC, x , ES2, 2012) EXT(KHR_texture_compression_astc_sliced_3d , KHR_texture_compression_astc_sliced_3d , GLL, GLC, x , ES2, 2015) +EXT(MESA_EGL_sync , dummy_true , GLL, GLC, x , x , 2019) EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 31, 2018) EXT(MESA_pack_invert , MESA_pack_invert , GLL, GLC, x , x , 2002) EXT(MESA_shader_integer_functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016) -- 2.30.2