dawn: Fix OpenGL context creation for Nvidia / Linux

Change 104120 enabled `EGL_EXT_create_context_robustness` to ensure that robustness is enabled for OpenGL.

Despite listing `EGL_EXT_create_context_robustness` in the extension list, Nvidia linux drivers will error with `EGL_BAD_ATTRIBUTE` when `EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT` is specified when requesting an OpenGL context (ES works fine!)

EGL promoted this extension to core in EGL 1.5, and requesting `EGL_CONTEXT_OPENGL_ROBUST_ACCESS` keeps Nvidia happy - so use this instead.

Note: We already require EGL 1.5 for EGLImage.
Change-Id: I6012773aef0d53b1d147228f40e0348865e98107
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106884
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2022-10-25 13:03:36 +00:00 committed by Dawn LUCI CQ
parent 80b2312493
commit 14281033e5
1 changed files with 2 additions and 6 deletions

View File

@ -19,10 +19,6 @@
#include "dawn/native/opengl/UtilsEGL.h" #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 { namespace dawn::native::opengl {
ResultOrError<std::unique_ptr<ContextEGL>> ContextEGL::Create(const EGLFunctions& egl, ResultOrError<std::unique_ptr<ContextEGL>> ContextEGL::Create(const EGLFunctions& egl,
@ -76,11 +72,11 @@ ResultOrError<std::unique_ptr<ContextEGL>> ContextEGL::Create(const EGLFunctions
major, major,
EGL_CONTEXT_MINOR_VERSION, EGL_CONTEXT_MINOR_VERSION,
minor, minor,
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_CONTEXT_OPENGL_ROBUST_ACCESS, // Core in EGL 1.5
EGL_TRUE, EGL_TRUE,
EGL_NONE, EGL_NONE,
EGL_NONE,
}; };
EGLContext context = egl.CreateContext(display, config, EGL_NO_CONTEXT, attrib_list); EGLContext context = egl.CreateContext(display, config, EGL_NO_CONTEXT, attrib_list);
DAWN_TRY(CheckEGL(egl, context != EGL_NO_CONTEXT, "eglCreateContext")); DAWN_TRY(CheckEGL(egl, context != EGL_NO_CONTEXT, "eglCreateContext"));