From f4d429c1cbc1351ea9f1ac74e0f22b085d275179 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Thu, 13 Sep 2018 11:20:52 -0400 Subject: [PATCH] Fix EGL enum allocation. The following enums had a small typo causing them to be takend from an unused block: EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE Fix this by temporarily defining a secondary enum. Once Chromium is fixed upstream we can remove the temporary enum. Reported by dan.glastonbury@gmail.com. Bug: angleproject:2806 Change-Id: I2ce1dec0a30d5e83f2bec0ae243fd860cbcea4fc Reviewed-on: https://chromium-review.googlesource.com/1220371 Commit-Queue: Jamie Madill Reviewed-by: Yuly Novikov --- ...L_ANGLE_create_context_webgl_compatibility.txt | 2 +- ...IUM_create_context_bind_generates_resource.txt | 2 +- include/EGL/eglext_angle.h | 12 +++++++++--- src/libANGLE/Context.cpp | 15 +++++++++++++-- src/libANGLE/Display.cpp | 4 +++- src/libANGLE/validationEGL.cpp | 6 ++++++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/extensions/EGL_ANGLE_create_context_webgl_compatibility.txt b/extensions/EGL_ANGLE_create_context_webgl_compatibility.txt index 2e7fb825d..4245d6ca7 100644 --- a/extensions/EGL_ANGLE_create_context_webgl_compatibility.txt +++ b/extensions/EGL_ANGLE_create_context_webgl_compatibility.txt @@ -53,7 +53,7 @@ New Tokens Accepted as an attribute name in the <*attrib_list> argument to eglCreateContext: - EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC + EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x33AC Additions to the EGL 1.4 Specification diff --git a/extensions/EGL_CHROMIUM_create_context_bind_generates_resource.txt b/extensions/EGL_CHROMIUM_create_context_bind_generates_resource.txt index b34ce8249..7b623e924 100644 --- a/extensions/EGL_CHROMIUM_create_context_bind_generates_resource.txt +++ b/extensions/EGL_CHROMIUM_create_context_bind_generates_resource.txt @@ -53,7 +53,7 @@ New Tokens Accepted as an attribute name in the <*attrib_list> argument to eglCreateContext: - EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD + EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD Additions to the EGL 1.4 Specification diff --git a/include/EGL/eglext_angle.h b/include/EGL/eglext_angle.h index 9671df9fe..7dfc11ee3 100644 --- a/include/EGL/eglext_angle.h +++ b/include/EGL/eglext_angle.h @@ -125,17 +125,23 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureANGLE(EGLDisplay dpy, EGLSt #ifndef EGL_ANGLE_create_context_webgl_compatibility #define EGL_ANGLE_create_context_webgl_compatibility 1 -#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC +#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x33AC +// TODO(jmadill): Remove this. http://anglebug.com/2806 +#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE_OLD 0x3AAC #endif /* EGL_ANGLE_create_context_webgl_compatibility */ #ifndef EGL_ANGLE_display_texture_share_group #define EGL_ANGLE_display_texture_share_group 1 -#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x3AAF +#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x33AF +// TODO(jmadill): Remove this. http://anglebug.com/2806 +#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE_OLD 0x3AAF #endif /* EGL_ANGLE_display_texture_share_group */ #ifndef EGL_CHROMIUM_create_context_bind_generates_resource #define EGL_CHROMIUM_create_context_bind_generates_resource 1 -#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD +#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD +// TODO(jmadill): Remove this. http://anglebug.com/2806 +#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM_OLD 0x3AAD #endif /* EGL_CHROMIUM_create_context_bind_generates_resource */ #ifndef EGL_ANGLE_create_context_client_arrays diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index 0cb16bc49..a307400a3 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -198,7 +198,9 @@ bool GetNoError(const egl::AttributeMap &attribs) bool GetWebGLContext(const egl::AttributeMap &attribs) { - return (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE, EGL_FALSE) == EGL_TRUE); + // TODO(jmadill): Remove this. http://anglebug.com/2806 + return (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE, EGL_FALSE) == EGL_TRUE) || + (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE_OLD, EGL_FALSE) == EGL_TRUE); } bool GetExtensionsEnabled(const egl::AttributeMap &attribs, bool webGLContext) @@ -210,7 +212,16 @@ bool GetExtensionsEnabled(const egl::AttributeMap &attribs, bool webGLContext) bool GetBindGeneratesResource(const egl::AttributeMap &attribs) { - return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE) == EGL_TRUE); + // TODO(jmadill): Remove this. http://anglebug.com/2806 + if (attribs.contains(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM)) + { + return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE) == EGL_TRUE); + } + else + { + return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM_OLD, EGL_TRUE) == + EGL_TRUE); + } } bool GetClientArraysEnabled(const egl::AttributeMap &attribs) diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp index b2643d6a3..ff50a1327 100644 --- a/src/libANGLE/Display.cpp +++ b/src/libANGLE/Display.cpp @@ -763,8 +763,10 @@ Error Display::createContext(const Config *configuration, } // This display texture sharing will allow the first context to create the texture share group. + // TODO(jmadill): Remove this. http://anglebug.com/2806 bool usingDisplayTextureShareGroup = - attribs.get(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE, EGL_FALSE) == EGL_TRUE; + attribs.get(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE, EGL_FALSE) == EGL_TRUE || + attribs.get(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE_OLD, EGL_FALSE) == EGL_TRUE; gl::TextureManager *shareTextures = nullptr; if (usingDisplayTextureShareGroup) diff --git a/src/libANGLE/validationEGL.cpp b/src/libANGLE/validationEGL.cpp index 3a772be4c..77d335ba1 100644 --- a/src/libANGLE/validationEGL.cpp +++ b/src/libANGLE/validationEGL.cpp @@ -879,6 +879,8 @@ Error ValidateCreateContext(Display *display, } break; + // TODO(jmadill): Remove this. http://anglebug.com/2806 + case EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE_OLD: case EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE: if (!display->getExtensions().createContextWebGLCompatibility) { @@ -893,6 +895,8 @@ Error ValidateCreateContext(Display *display, } break; + // TODO(jmadill): Remove this. http://anglebug.com/2806 + case EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM_OLD: case EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM: if (!display->getExtensions().createContextBindGeneratesResource) { @@ -907,6 +911,8 @@ Error ValidateCreateContext(Display *display, } break; + // TODO(jmadill): Remove this. http://anglebug.com/2806 + case EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE_OLD: case EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE: if (!display->getExtensions().displayTextureShareGroup) {