<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210164] releases/WebKitGTK/webkit-2.14/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210164">210164</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-27 03:52:23 -0800 (Tue, 27 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/208997">r208997</a> - [GTK] Dramatic increase on memory usage since 2.14.x
https://bugs.webkit.org/show_bug.cgi?id=164049
Reviewed by Žan Doberšek.
Use OpenGL version 3.2 Core for rendering when available.
Update some operations that have changed when using 3.2 Core:
- Use glGetStringi to get the extensions list.
- Do not use GL_POINT_SPRITE.
- Always use a VAO when rendering.
- Use a GLSL 1.50 compatible shader.
No new tests needed.
* platform/graphics/GLContext.cpp:
(WebCore::GLContext::version):
Add a method to get OpenGL version we are using.
* platform/graphics/GLContext.h:
Ditto.
* platform/graphics/GraphicsContext3D.h:
Add an attribute to store the VAO used for rendering.
* platform/graphics/OpenGLShims.cpp:
(WebCore::initializeOpenGLShims):
Add glGetStringi to the list of functions.
* platform/graphics/OpenGLShims.h:
Ditto.
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
Set appropriate output to the shader compiler and initalize the VAO if needed.
(WebCore::GraphicsContext3D::~GraphicsContext3D):
Delete the VAO if needed.
(WebCore::GraphicsContext3D::getExtensions):
Use glGetExtensionsi for OpenGL versions >= 3.2.
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::hasGLXARBCreateContextExtension):
Check whether the GLX_ARB_create_context extension is available.
(WebCore::GLContextGLX::createWindowContext):
Use glXCreateContextAttribsARB() if possible to request an OpenGL 3.2 context.
(WebCore::GLContextGLX::createPbufferContext):
Ditto.
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
(WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
Enable glGetStringi for GTK.
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
Do not use default getExtensions() method for GTK.
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGLContextcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGLContexth">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.h</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGraphicsContext3Dh">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsOpenGLShimscpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsOpenGLShimsh">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.h</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicscairoGraphicsContext3DCairocpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsglxGLContextGLXcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLEScpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit214SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2016-11-28 Miguel Gomez <magomez@igalia.com>
+
+ [GTK] Dramatic increase on memory usage since 2.14.x
+ https://bugs.webkit.org/show_bug.cgi?id=164049
+
+ Reviewed by Žan Doberšek.
+
+ Use OpenGL version 3.2 Core for rendering when available.
+ Update some operations that have changed when using 3.2 Core:
+ - Use glGetStringi to get the extensions list.
+ - Do not use GL_POINT_SPRITE.
+ - Always use a VAO when rendering.
+ - Use a GLSL 1.50 compatible shader.
+
+ No new tests needed.
+
+ * platform/graphics/GLContext.cpp:
+ (WebCore::GLContext::version):
+ Add a method to get OpenGL version we are using.
+ * platform/graphics/GLContext.h:
+ Ditto.
+ * platform/graphics/GraphicsContext3D.h:
+ Add an attribute to store the VAO used for rendering.
+ * platform/graphics/OpenGLShims.cpp:
+ (WebCore::initializeOpenGLShims):
+ Add glGetStringi to the list of functions.
+ * platform/graphics/OpenGLShims.h:
+ Ditto.
+ * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ Set appropriate output to the shader compiler and initalize the VAO if needed.
+ (WebCore::GraphicsContext3D::~GraphicsContext3D):
+ Delete the VAO if needed.
+ (WebCore::GraphicsContext3D::getExtensions):
+ Use glGetExtensionsi for OpenGL versions >= 3.2.
+ * platform/graphics/glx/GLContextGLX.cpp:
+ (WebCore::hasGLXARBCreateContextExtension):
+ Check whether the GLX_ARB_create_context extension is available.
+ (WebCore::GLContextGLX::createWindowContext):
+ Use glXCreateContextAttribsARB() if possible to request an OpenGL 3.2 context.
+ (WebCore::GLContextGLX::createPbufferContext):
+ Ditto.
+ * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
+ (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
+ Enable glGetStringi for GTK.
+ * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+ Do not use default getExtensions() method for GTK.
+ * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+ Ditto.
+
</ins><span class="cx"> 2016-10-28 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix Windows WebGL build after r208022
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGLContextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -160,6 +160,18 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned GLContext::version()
+{
+ if (!m_version) {
+ GC3Dint major = 0;
+ GC3Dint minor = 0;
+ ::glGetIntegerv(GL_MAJOR_VERSION, &major);
+ ::glGetIntegerv(GL_MINOR_VERSION, &minor);
+ m_version = major * 100 + minor * 10;
+ }
+ return m_version;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGLContexth"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.h (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.h        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.h        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> static bool isExtensionSupported(const char* extensionList, const char* extension);
</span><span class="cx">
</span><span class="cx"> PlatformDisplay& display() const { return m_display; }
</span><ins>+ unsigned version();
</ins><span class="cx">
</span><span class="cx"> virtual ~GLContext();
</span><span class="cx"> virtual bool makeContextCurrent();
</span><span class="lines">@@ -77,6 +78,7 @@
</span><span class="cx"> GLContext(PlatformDisplay&);
</span><span class="cx">
</span><span class="cx"> PlatformDisplay& m_display;
</span><ins>+ unsigned m_version { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GraphicsContext3D.h (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GraphicsContext3D.h        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GraphicsContext3D.h        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -1415,6 +1415,11 @@
</span><span class="cx"> WebGLRenderingContextBase* m_webglContext;
</span><span class="cx">
</span><span class="cx"> bool m_isForWebGL2 { false };
</span><ins>+
+#if USE(CAIRO)
+ Platform3DObject m_vao { 0 };
+#endif
+
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsOpenGLShimscpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -162,6 +162,9 @@
</span><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetShaderInfoLog, success);
</span><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetShaderiv, success);
</span><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetShaderSource, success);
</span><ins>+ // glGetStringi is only available on OpenGL or GLES versions >= 3.0.
+ // Add it with _EXT so it doesn't cause an initialization failure on lower versions.
+ ASSIGN_FUNCTION_TABLE_ENTRY_EXT(glGetStringi);
</ins><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetUniformfv, success);
</span><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetUniformiv, success);
</span><span class="cx"> ASSIGN_FUNCTION_TABLE_ENTRY(glGetUniformLocation, success);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsOpenGLShimsh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.h (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.h        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/OpenGLShims.h        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx"> typedef void (GLAPIENTRY *glGetShaderInfoLogType) (GLuint, GLsizei, GLsizei*, char*);
</span><span class="cx"> typedef void (GLAPIENTRY *glGetShaderivType) (GLuint, GLenum, GLint*);
</span><span class="cx"> typedef void (GLAPIENTRY *glGetShaderSourceType) (GLuint, GLsizei, GLsizei*, char*);
</span><ins>+typedef const GLubyte* (GLAPIENTRY *glGetStringiType) (GLenum, GLuint);
</ins><span class="cx"> typedef GLint (GLAPIENTRY *glGetUniformLocationType) (GLuint, const char*);
</span><span class="cx"> typedef void (GLAPIENTRY *glGetUniformfvType) (GLuint, GLint, GLfloat*);
</span><span class="cx"> typedef void (GLAPIENTRY *glGetUniformivType) (GLuint, GLint, GLint*);
</span><span class="lines">@@ -198,6 +199,7 @@
</span><span class="cx"> FUNCTION_TABLE_ENTRY(glGetShaderInfoLog);
</span><span class="cx"> FUNCTION_TABLE_ENTRY(glGetShaderiv);
</span><span class="cx"> FUNCTION_TABLE_ENTRY(glGetShaderSource);
</span><ins>+ FUNCTION_TABLE_ENTRY(glGetStringi);
</ins><span class="cx"> FUNCTION_TABLE_ENTRY(glGetUniformfv);
</span><span class="cx"> FUNCTION_TABLE_ENTRY(glGetUniformiv);
</span><span class="cx"> FUNCTION_TABLE_ENTRY(glGetUniformLocation);
</span><span class="lines">@@ -325,6 +327,7 @@
</span><span class="cx"> #define glGetShaderInfoLog LOOKUP_GL_FUNCTION(glGetShaderInfoLog)
</span><span class="cx"> #define glGetShaderiv LOOKUP_GL_FUNCTION(glGetShaderiv)
</span><span class="cx"> #define glGetShaderSource LOOKUP_GL_FUNCTION(glGetShaderSource)
</span><ins>+#define glGetStringi LOOKUP_GL_FUNCTION(glGetStringi)
</ins><span class="cx"> #define glGetUniformfv LOOKUP_GL_FUNCTION(glGetUniformfv)
</span><span class="cx"> #define glGetUniformiv LOOKUP_GL_FUNCTION(glGetUniformiv)
</span><span class="cx"> #define glGetUniformLocation LOOKUP_GL_FUNCTION(glGetUniformLocation)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicscairoGraphicsContext3DCairocpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -79,7 +79,6 @@
</span><span class="cx"> GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
</span><span class="cx"> : m_currentWidth(0)
</span><span class="cx"> , m_currentHeight(0)
</span><del>- , m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_COMPATIBILITY_OUTPUT)
</del><span class="cx"> , m_attrs(attributes)
</span><span class="cx"> , m_texture(0)
</span><span class="cx"> , m_compositorTexture(0)
</span><span class="lines">@@ -145,6 +144,34 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !USE(OPENGL_ES_2)
+ ::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+
+ if (GLContext::current()->version() >= 320) {
+ // From version 3.2 on we use the OpenGL Core profile, so request that ouput to the shader compiler.
+ // OpenGL version 3.2 uses GLSL version 1.50.
+ m_compiler = ANGLEWebKitBridge(SH_GLSL_150_CORE_OUTPUT);
+
+ // From version 3.2 on we use the OpenGL Core profile, and we need a VAO for rendering.
+ // A VAO could be created and bound by each component using GL rendering (TextureMapper, WebGL, etc). This is
+ // a simpler solution: the first GraphicsContext3D created on a GLContext will create and bind a VAO for that context.
+ GC3Dint currentVAO = 0;
+ getIntegerv(GraphicsContext3D::VERTEX_ARRAY_BINDING, &currentVAO);
+ if (!currentVAO) {
+ m_vao = createVertexArray();
+ bindVertexArray(m_vao);
+ }
+ } else {
+ // For lower versions request the compatibility output to the shader compiler.
+ m_compiler = ANGLEWebKitBridge(SH_GLSL_COMPATIBILITY_OUTPUT);
+
+ // GL_POINT_SPRITE is needed in lower versions.
+ ::glEnable(GL_POINT_SPRITE);
+ }
+#else
+ m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT);
+#endif
+
</ins><span class="cx"> // ANGLE initialization.
</span><span class="cx"> ShBuiltInResources ANGLEResources;
</span><span class="cx"> ShInitBuiltInResources(&ANGLEResources);
</span><span class="lines">@@ -166,11 +193,6 @@
</span><span class="cx">
</span><span class="cx"> m_compiler.setResources(ANGLEResources);
</span><span class="cx">
</span><del>-#if !USE(OPENGL_ES_2)
- ::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
- ::glEnable(GL_POINT_SPRITE);
-#endif
-
</del><span class="cx"> ::glClearColor(0, 0, 0, 0);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -198,6 +220,9 @@
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_THREADED)
</span><span class="cx"> ::glDeleteTextures(1, &m_intermediateTexture);
</span><span class="cx"> #endif
</span><ins>+
+ if (m_vao)
+ deleteVertexArray(m_vao);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GraphicsContext3D::ImageExtractor::~ImageExtractor()
</span><span class="lines">@@ -340,6 +365,22 @@
</span><span class="cx"> return m_private.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(GTK)
+Extensions3D* GraphicsContext3D::getExtensions()
+{
+ if (!m_extensions) {
+#if USE(OPENGL_ES_2)
+ // glGetStringi is not available on GLES2.
+ m_extensions = std::make_unique<Extensions3DOpenGLES>(this, false);
+#else
+ // From OpenGL 3.2 on we use the Core profile, and there we must use glGetStringi.
+ m_extensions = std::make_unique<Extensions3DOpenGL>(this, GLContext::current()->version() >= 320);
+#endif
+ }
+ return m_extensions.get();
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(GRAPHICS_CONTEXT_3D)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsglxGLContextGLXcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -38,8 +38,12 @@
</span><span class="cx"> #if !defined(PFNGLXSWAPINTERVALSGIPROC)
</span><span class="cx"> typedef int (*PFNGLXSWAPINTERVALSGIPROC) (int);
</span><span class="cx"> #endif
</span><ins>+#if !defined(PFNGLXCREATECONTEXTATTRIBSARBPROC)
+typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+#endif
</ins><span class="cx">
</span><span class="cx"> static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
</span><ins>+static PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
</ins><span class="cx">
</span><span class="cx"> static bool hasSGISwapControlExtension(Display* display)
</span><span class="cx"> {
</span><span class="lines">@@ -55,6 +59,20 @@
</span><span class="cx"> return !!glXSwapIntervalSGI;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool hasGLXARBCreateContextExtension(Display* display)
+{
+ static bool initialized = false;
+ if (initialized)
+ return !!glXCreateContextAttribsARB;
+
+ initialized = true;
+ if (!GLContext::isExtensionSupported(glXQueryExtensionsString(display, 0), "GLX_ARB_create_context"))
+ return false;
+
+ glXCreateContextAttribsARB = reinterpret_cast<PFNGLXCREATECONTEXTATTRIBSARBPROC>(glXGetProcAddress(reinterpret_cast<const unsigned char*>("glXCreateContextAttribsARB")));
+ return !!glXCreateContextAttribsARB;
+}
+
</ins><span class="cx"> std::unique_ptr<GLContextGLX> GLContextGLX::createWindowContext(GLNativeWindowType window, PlatformDisplay& platformDisplay, GLXContext sharingContext)
</span><span class="cx"> {
</span><span class="cx"> Display* display = downcast<PlatformDisplayX11>(platformDisplay).native();
</span><span class="lines">@@ -65,10 +83,38 @@
</span><span class="cx"> XVisualInfo visualInfo;
</span><span class="cx"> visualInfo.visualid = XVisualIDFromVisual(attributes.visual);
</span><span class="cx">
</span><del>- int numReturned = 0;
- XUniquePtr<XVisualInfo> visualInfoList(XGetVisualInfo(display, VisualIDMask, &visualInfo, &numReturned));
</del><ins>+ int numConfigs = 0;
+ GLXFBConfig config = nullptr;
+ XUniquePtr<GLXFBConfig> configs(glXGetFBConfigs(display, DefaultScreen(display), &numConfigs));
+ for (int i = 0; i < numConfigs; i++) {
+ XUniquePtr<XVisualInfo> glxVisualInfo(glXGetVisualFromFBConfig(display, configs.get()[i]));
+ if (!glxVisualInfo)
+ continue;
</ins><span class="cx">
</span><del>- XUniqueGLXContext context(glXCreateContext(display, visualInfoList.get(), sharingContext, True));
</del><ins>+ if (glxVisualInfo.get()->visualid == visualInfo.visualid) {
+ config = configs.get()[i];
+ break;
+ }
+ }
+ ASSERT(config);
+
+ XUniqueGLXContext context;
+ if (hasGLXARBCreateContextExtension(display)) {
+ // Request OpenGL version 3.2 and core profile, which guarantees that the i965 driver doesn't use the software renderer.
+ static const int contextAttributes[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 2,
+ 0
+ };
+ context.reset(glXCreateContextAttribsARB(display, config, sharingContext, GL_TRUE, contextAttributes));
+ }
+
+ if (!context) {
+ // Fallback to legacy OpenGL version.
+ XUniquePtr<XVisualInfo> visualInfoList(glXGetVisualFromFBConfig(display, config));
+ context.reset(glXCreateContext(display, visualInfoList.get(), sharingContext, True));
+ }
+
</ins><span class="cx"> if (!context)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="lines">@@ -100,7 +146,23 @@
</span><span class="cx"> if (!pbuffer)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- XUniqueGLXContext context(glXCreateNewContext(display, configs.get()[0], GLX_RGBA_TYPE, sharingContext, GL_TRUE));
</del><ins>+ XUniqueGLXContext context;
+
+ if (hasGLXARBCreateContextExtension(display)) {
+ // Request OpenGL version 3.2 and core profile, which guarantees that the i965 driver doesn't use the software renderer.
+ static const int contextAttributes[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 2,
+ 0
+ };
+ context.reset(glXCreateContextAttribsARB(display, configs.get()[0], sharingContext, GL_TRUE, contextAttributes));
+ }
+
+ if (!context) {
+ // Fallback to legacy OpenGL version.
+ context.reset(glXCreateNewContext(display, configs.get()[0], GLX_RGBA_TYPE, sharingContext, GL_TRUE));
+ }
+
</ins><span class="cx"> if (!context)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglExtensions3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -209,7 +209,7 @@
</span><span class="cx">
</span><span class="cx"> void Extensions3DOpenGLCommon::initializeAvailableExtensions()
</span><span class="cx"> {
</span><del>-#if PLATFORM(MAC)
</del><ins>+#if PLATFORM(MAC) || PLATFORM(GTK)
</ins><span class="cx"> if (m_useIndexedGetString) {
</span><span class="cx"> GLint numExtensions = 0;
</span><span class="cx"> ::glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -406,6 +406,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(GTK)
</ins><span class="cx"> Extensions3D* GraphicsContext3D::getExtensions()
</span><span class="cx"> {
</span><span class="cx"> if (!m_extensions)
</span><span class="lines">@@ -412,6 +413,7 @@
</span><span class="cx"> m_extensions = std::make_unique<Extensions3DOpenGL>(this, isGLES2Compliant());
</span><span class="cx"> return m_extensions.get();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data)
</span><span class="cx"> {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLEScpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (210163 => 210164)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp        2016-12-27 11:52:11 UTC (rev 210163)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp        2016-12-27 11:52:23 UTC (rev 210164)
</span><span class="lines">@@ -241,6 +241,7 @@
</span><span class="cx"> ::glClearDepthf(depth);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if !PLATFORM(GTK)
</ins><span class="cx"> Extensions3D* GraphicsContext3D::getExtensions()
</span><span class="cx"> {
</span><span class="cx"> if (!m_extensions)
</span><span class="lines">@@ -247,6 +248,7 @@
</span><span class="cx"> m_extensions = std::make_unique<Extensions3DOpenGLES>(this, isGLES2Compliant());
</span><span class="cx"> return m_extensions.get();
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>