Changeset 209234 in webkit


Ignore:
Timestamp:
Dec 2, 2016 5:22:51 AM (7 years ago)
Author:
magomez@igalia.com
Message:

[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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209233 r209234  
     12016-12-02  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GTK] Use an OpenGL < 3.0 compliant way to request the OpenGL version
     4        https://bugs.webkit.org/show_bug.cgi?id=165253
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Use glGetString(GL_VERSION) to get the OpenGL version, as glGetIntegerv with GL_MAJOR_VERSION
     9        and GL_MINOR_VERSION is only supported from 3.0 on.
     10
     11        Covered by existent tests.
     12
     13        * platform/graphics/GLContext.cpp:
     14        (WebCore::GLContext::version):
     15
    1162016-12-02  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r209233 r209234  
    169169{
    170170    if (!m_version) {
    171         GC3Dint major = 0;
    172         GC3Dint minor = 0;
    173         ::glGetIntegerv(GL_MAJOR_VERSION, &major);
    174         ::glGetIntegerv(GL_MINOR_VERSION, &minor);
    175         m_version = major * 100 + minor * 10;
     171        // Version string can start with the version number (all versions except GLES 1 and 2) or with
     172        // "OpenGL". Different fields inside the version string are separated by spaces.
     173        String versionString = String(reinterpret_cast<const char*>(::glGetString(GL_VERSION)));
     174        Vector<String> versionStringComponents;
     175        versionString.split(' ', versionStringComponents);
     176
     177        Vector<String> versionDigits;
     178        if (versionStringComponents[0] == "OpenGL") {
     179            // If the version string starts with "OpenGL" it can be GLES 1 or 2. In GLES1 version string starts
     180            // with "OpenGL ES-<profile> major.minor" and in GLES2 with "OpenGL ES major.minor". Version is the
     181            // third component in both cases.
     182            versionStringComponents[2].split('.', versionDigits);
     183        } else {
     184            // Version is the first component. The version number is always "major.minor" or
     185            // "major.minor.release". Ignore the release number.
     186            versionStringComponents[0].split('.', versionDigits);
     187        }
     188
     189        m_version = versionDigits[0].toUInt() * 100 + versionDigits[1].toUInt() * 10;
    176190    }
    177191    return m_version;
Note: See TracChangeset for help on using the changeset viewer.