Title: [252851] trunk/Source/WebKit
- Revision
- 252851
- Author
- [email protected]
- Date
- 2019-11-25 02:08:39 -0800 (Mon, 25 Nov 2019)
Log Message
[GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland
https://bugs.webkit.org/show_bug.cgi?id=204446
Reviewed by Carlos Garcia Campos.
This change is part of efforts bringing ANGLE backend for WebGL to the gtk port.
When ANGLE WebGL is enabled, we face a dilemma of choosing either Extensions3DANGLE
or Extensions3DOpenGL in AcceleratedBackingStoreWayland.cpp. Since they cannot
coexist, we chose Extensions3DANGLE even if what we really want is Extensions3DOepnGL.
We address this problem by directly checking egl image extension availability
via native GL API rather than relying on Extensions3D* classes in the file.
* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::isEGLImageAvailable):
(WebKit::AcceleratedBackingStoreWayland::checkRequirements):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (252850 => 252851)
--- trunk/Source/WebKit/ChangeLog 2019-11-25 09:48:18 UTC (rev 252850)
+++ trunk/Source/WebKit/ChangeLog 2019-11-25 10:08:39 UTC (rev 252851)
@@ -1,3 +1,21 @@
+2019-11-25 ChangSeok Oh <[email protected]>
+
+ [GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland
+ https://bugs.webkit.org/show_bug.cgi?id=204446
+
+ Reviewed by Carlos Garcia Campos.
+
+ This change is part of efforts bringing ANGLE backend for WebGL to the gtk port.
+ When ANGLE WebGL is enabled, we face a dilemma of choosing either Extensions3DANGLE
+ or Extensions3DOpenGL in AcceleratedBackingStoreWayland.cpp. Since they cannot
+ coexist, we chose Extensions3DANGLE even if what we really want is Extensions3DOepnGL.
+ We address this problem by directly checking egl image extension availability
+ via native GL API rather than relying on Extensions3D* classes in the file.
+
+ * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
+ (WebKit::isEGLImageAvailable):
+ (WebKit::AcceleratedBackingStoreWayland::checkRequirements):
+
2019-11-25 Youenn Fablet <[email protected]>
Crash in WebCore::ServiceWorkerRegistrationKey::hash() const
Modified: trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp (252850 => 252851)
--- trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2019-11-25 09:48:18 UTC (rev 252850)
+++ trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp 2019-11-25 10:08:39 UTC (rev 252851)
@@ -38,15 +38,10 @@
#include <WebCore/CairoUtilities.h>
#include <WebCore/GLContext.h>
-#if USE(ANGLE)
-#include <WebCore/Extensions3DANGLE.h>
-#include <WebCore/OpenGLShims.h>
-#elif USE(OPENGL_ES)
+#if USE(OPENGL_ES)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <WebCore/Extensions3DOpenGLES.h>
#else
-#include <WebCore/Extensions3DOpenGL.h>
#include <WebCore/OpenGLShims.h>
#endif
@@ -67,6 +62,32 @@
namespace WebKit {
using namespace WebCore;
+bool isEGLImageAvailable(bool useIndexedGetString)
+{
+#if USE(OPENGL_ES)
+ UNUSED_PARAM(useIndexedGetString);
+#else
+ if (useIndexedGetString) {
+ GLint numExtensions = 0;
+ ::glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+ for (GLint i = 0; i < numExtensions; ++i) {
+ String extension = String(reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i)));
+ if (extension == "GL_OES_EGL_image" || extension == "GL_OES_EGL_image_external")
+ return true;
+ }
+ } else
+#endif
+ {
+ String extensionsString = String(reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS)));
+ for (auto& extension : extensionsString.split(' ')) {
+ if (extension == "GL_OES_EGL_image" || extension == "GL_OES_EGL_image_external")
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool AcceleratedBackingStoreWayland::checkRequirements()
{
#if USE(WPE_RENDERER)
@@ -81,14 +102,11 @@
if (!eglContext->makeContextCurrent())
return false;
-#if USE(ANGLE)
- std::unique_ptr<Extensions3DANGLE> glExtensions = makeUnique<Extensions3DANGLE>(nullptr, GLContext::current()->version() >= 320);
-#elif USE(OPENGL_ES)
- std::unique_ptr<Extensions3DOpenGLES> glExtensions = makeUnique<Extensions3DOpenGLES>(nullptr, false);
+#if USE(OPENGL_ES)
+ if (isEGLImageAvailable(false))
#else
- std::unique_ptr<Extensions3DOpenGL> glExtensions = makeUnique<Extensions3DOpenGL>(nullptr, GLContext::current()->version() >= 320);
+ if (isEGLImageAvailable(GLContext::current()->version() >= 320))
#endif
- if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external"))
glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes