diff --git a/src/dawn/native/opengl/ContextEGL.cpp b/src/dawn/native/opengl/ContextEGL.cpp index b2618a32c8..ab42663b03 100644 --- a/src/dawn/native/opengl/ContextEGL.cpp +++ b/src/dawn/native/opengl/ContextEGL.cpp @@ -19,6 +19,10 @@ #include "dawn/native/opengl/UtilsEGL.h" +#ifndef EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#endif + namespace dawn::native::opengl { ResultOrError> ContextEGL::Create(const EGLFunctions& egl, @@ -61,8 +65,21 @@ ResultOrError> ContextEGL::Create(const EGLFunctions major = 4; minor = 4; } + + const char* extensions = egl.QueryString(display, EGL_EXTENSIONS); + if (strstr(extensions, "EGL_EXT_create_context_robustness") == nullptr) { + return DAWN_INTERNAL_ERROR("EGL_EXT_create_context_robustness must be supported"); + } + EGLint attrib_list[] = { - EGL_CONTEXT_MAJOR_VERSION, major, EGL_CONTEXT_MINOR_VERSION, minor, EGL_NONE, EGL_NONE, + EGL_CONTEXT_MAJOR_VERSION, + major, + EGL_CONTEXT_MINOR_VERSION, + minor, + EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, + EGL_TRUE, + EGL_NONE, + EGL_NONE, }; EGLContext context = egl.CreateContext(display, config, EGL_NO_CONTEXT, attrib_list); DAWN_TRY(CheckEGL(egl, context != EGL_NO_CONTEXT, "eglCreateContext")); diff --git a/src/dawn/native/opengl/EGLFunctions.cpp b/src/dawn/native/opengl/EGLFunctions.cpp index 5796131d42..67e68572cb 100644 --- a/src/dawn/native/opengl/EGLFunctions.cpp +++ b/src/dawn/native/opengl/EGLFunctions.cpp @@ -38,6 +38,7 @@ void EGLFunctions::Init(void* (*getProc)(const char*)) { GetError = reinterpret_cast(GetProcAddress("eglGetError")); Initialize = reinterpret_cast(GetProcAddress("eglInitialize")); MakeCurrent = reinterpret_cast(GetProcAddress("eglMakeCurrent")); + QueryString = reinterpret_cast(GetProcAddress("eglQueryString")); } } // namespace dawn::native::opengl diff --git a/src/dawn/native/opengl/EGLFunctions.h b/src/dawn/native/opengl/EGLFunctions.h index 5c2688fb66..399ee9d5df 100644 --- a/src/dawn/native/opengl/EGLFunctions.h +++ b/src/dawn/native/opengl/EGLFunctions.h @@ -36,6 +36,7 @@ struct EGLFunctions { PFNEGLGETPROCADDRESSPROC GetProcAddress; PFNEGLINITIALIZEPROC Initialize; PFNEGLMAKECURRENTPROC MakeCurrent; + PFNEGLQUERYSTRINGPROC QueryString; }; } // namespace dawn::native::opengl