Title: [210166] releases/WebKitGTK/webkit-2.14/Source/WebCore
Revision
210166
Author
[email protected]
Date
2016-12-27 04:11:14 -0800 (Tue, 27 Dec 2016)

Log Message

Merge r209234 - [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version
https://bugs.webkit.org/show_bug.cgi?id=165253

Reviewed by Carlos Garcia Campos.

Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION
and GL_MINOR_VERSION is only supported from 3.0 on.

Covered by existent tests.

* platform/graphics/GLContext.cpp:
(WebCore::GLContext::version):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (210165 => 210166)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 11:52:31 UTC (rev 210165)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 12:11:14 UTC (rev 210166)
@@ -1,3 +1,18 @@
+2016-12-02  Miguel Gomez  <[email protected]>
+
+        [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version
+        https://bugs.webkit.org/show_bug.cgi?id=165253
+
+        Reviewed by Carlos Garcia Campos.
+
+        Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION
+        and GL_MINOR_VERSION is only supported from 3.0 on.
+
+        Covered by existent tests.
+
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::version):
+
 2016-12-22  Michael Catanzaro  <[email protected]>
 
         [GTK] GLES build broken since r208997

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp (210165 => 210166)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp	2016-12-27 11:52:31 UTC (rev 210165)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/GLContext.cpp	2016-12-27 12:11:14 UTC (rev 210166)
@@ -163,11 +163,25 @@
 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;
+        // Version string can start with the version number (all versions except GLES 1 and 2) or with
+        // "OpenGL". Different fields inside the version string are separated by spaces.
+        String versionString = String(reinterpret_cast<const char*>(::glGetString(GL_VERSION)));
+        Vector<String> versionStringComponents;
+        versionString.split(' ', versionStringComponents);
+
+        Vector<String> versionDigits;
+        if (versionStringComponents[0] == "OpenGL") {
+            // If the version string starts with "OpenGL" it can be GLES 1 or 2. In GLES1 version string starts
+            // with "OpenGL ES-<profile> major.minor" and in GLES2 with "OpenGL ES major.minor". Version is the
+            // third component in both cases.
+            versionStringComponents[2].split('.', versionDigits);
+        } else {
+            // Version is the first component. The version number is always "major.minor" or
+            // "major.minor.release". Ignore the release number.
+            versionStringComponents[0].split('.', versionDigits);
+        }
+
+        m_version = versionDigits[0].toUInt() * 100 + versionDigits[1].toUInt() * 10;
     }
     return m_version;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to