Changeset 167520 in webkit


Ignore:
Timestamp:
Apr 18, 2014 5:29:45 PM (10 years ago)
Author:
dino@apple.com
Message:

[WebGL] Limit maximum texture sizes on older Intel hardware
https://bugs.webkit.org/show_bug.cgi?id=131867

Reviewed by Geoffrey Garen.

Both Chrome and Firefox limit the MAX_TEXTURE_SIZE on
older Intel hardware to be at most 4096. This does the
same for WebKit.

  • platform/graphics/Extensions3D.h: Add requiresRestrictedMaximumTextureSize() accessor.
  • platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:

(WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon): Record the value of GL_RENDERER
and test for "Intel HD Graphics 3000", which is the problematic hardware.

  • platform/graphics/opengl/Extensions3DOpenGLCommon.h:

(WebCore::Extensions3DOpenGLCommon::requiresRestrictedMaximumTextureSize): Getter.

  • platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:

(WebCore::GraphicsContext3D::getIntegerv): If you're asking for MAX_TEXTURE_SIZE or
MAX_CUBE_MAP_TEXTURE_SIZE, and you're on problematic hardware, return a clamped value
(4096 and 1024 respectively).

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167518 r167520  
     12014-04-18  Dean Jackson  <dino@apple.com>
     2
     3        [WebGL] Limit maximum texture sizes on older Intel hardware
     4        https://bugs.webkit.org/show_bug.cgi?id=131867
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Both Chrome and Firefox limit the MAX_TEXTURE_SIZE on
     9        older Intel hardware to be at most 4096. This does the
     10        same for WebKit.
     11
     12        * platform/graphics/Extensions3D.h: Add requiresRestrictedMaximumTextureSize() accessor.
     13        * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
     14        (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon): Record the value of GL_RENDERER
     15        and test for "Intel HD Graphics 3000", which is the problematic hardware.
     16        * platform/graphics/opengl/Extensions3DOpenGLCommon.h:
     17        (WebCore::Extensions3DOpenGLCommon::requiresRestrictedMaximumTextureSize): Getter.
     18        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
     19        (WebCore::GraphicsContext3D::getIntegerv): If you're asking for MAX_TEXTURE_SIZE or
     20        MAX_CUBE_MAP_TEXTURE_SIZE, and you're on problematic hardware, return a clamped value
     21        (4096 and 1024 respectively).
     22
    1232014-04-18  Hans Muller  <hmuller@adobe.com>
    224
  • trunk/Source/WebCore/platform/graphics/Extensions3D.h

    r166563 r167520  
    254254
    255255    // Some configurations have bugs regarding built-in functions in their OpenGL drivers
    256     // that must be avoided. Ports should implement this flag such configurations.
     256    // that must be avoided. Ports should implement these flags on such configurations.
    257257    virtual bool requiresBuiltInFunctionEmulation() = 0;
     258    virtual bool requiresRestrictedMaximumTextureSize() = 0;
     259
    258260};
    259261
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp

    r166563 r167520  
    6161    , m_maySupportMultisampling(true)
    6262    , m_requiresBuiltInFunctionEmulation(false)
     63    , m_requiresRestrictedMaximumTextureSize(false)
    6364{
    6465    m_vendor = String(reinterpret_cast<const char*>(::glGetString(GL_VENDOR)));
     66    m_renderer = String(reinterpret_cast<const char*>(::glGetString(GL_RENDERER)));
    6567
    6668    Vector<String> vendorComponents;
     
    9799    if (m_isAMD && !systemSupportsMultisampling)
    98100        m_maySupportMultisampling = false;
     101
     102    // Intel HD 3000 devices have problems with large textures. <rdar://problem/16649140>
     103    if (m_isIntel)
     104        m_requiresRestrictedMaximumTextureSize = m_renderer.startsWith("Intel HD Graphics 3000");
    99105#endif
    100106}
  • trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.h

    r166563 r167520  
    6868    virtual bool maySupportMultisampling() { return m_maySupportMultisampling; }
    6969    virtual bool requiresBuiltInFunctionEmulation() { return m_requiresBuiltInFunctionEmulation; }
     70    virtual bool requiresRestrictedMaximumTextureSize() { return m_requiresRestrictedMaximumTextureSize; }
    7071
    7172protected:
     
    8990    bool m_maySupportMultisampling;
    9091    bool m_requiresBuiltInFunctionEmulation;
     92    bool m_requiresRestrictedMaximumTextureSize;
    9193
    9294    String m_vendor;
     95    String m_renderer;
    9396};
    9497
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp

    r165676 r167520  
    241241        break;
    242242#endif
     243    case MAX_TEXTURE_SIZE:
     244        ::glGetIntegerv(MAX_TEXTURE_SIZE, value);
     245        if (getExtensions()->requiresRestrictedMaximumTextureSize())
     246            *value = std::min(4096, *value);
     247        break;
     248    case MAX_CUBE_MAP_TEXTURE_SIZE:
     249        ::glGetIntegerv(MAX_CUBE_MAP_TEXTURE_SIZE, value);
     250        if (getExtensions()->requiresRestrictedMaximumTextureSize())
     251            *value = std::min(1024, *value);
     252        break;
    243253    default:
    244254        ::glGetIntegerv(pname, value);
Note: See TracChangeset for help on using the changeset viewer.