Changeset 261769 in webkit


Ignore:
Timestamp:
May 15, 2020 4:57:24 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float
https://bugs.webkit.org/show_bug.cgi?id=211971

Patch by Kenneth Russell <kbr@chromium.org> on 2020-05-15
Reviewed by Dean Jackson.

Only adjust the internal formats of textures created for the WebGL
1.0 OES_texture_float extension if the WEBGL_color_buffer_float
extension has been enabled.

Covered by the WebGL 1.0 OES_texture_float conformance tests when
run on iOS with another forthcoming fix to ANGLE which will enable
the OES_texture_float extension on that platform.

  • platform/graphics/angle/ExtensionsGLANGLE.cpp:

(WebCore::ExtensionsGLANGLE::ensureEnabled):
(WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat):

  • platform/graphics/angle/ExtensionsGLANGLE.h:
  • platform/graphics/angle/GraphicsContextGLANGLE.cpp:

(WebCore::GraphicsContextGLOpenGL::texImage2DDirect):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261767 r261769  
     12020-05-15  Kenneth Russell  <kbr@chromium.org>
     2
     3        OES_texture_float internal format conversion must depend on WEBGL_color_buffer_float
     4        https://bugs.webkit.org/show_bug.cgi?id=211971
     5
     6        Reviewed by Dean Jackson.
     7
     8        Only adjust the internal formats of textures created for the WebGL
     9        1.0 OES_texture_float extension if the WEBGL_color_buffer_float
     10        extension has been enabled.
     11
     12        Covered by the WebGL 1.0 OES_texture_float conformance tests when
     13        run on iOS with another forthcoming fix to ANGLE which will enable
     14        the OES_texture_float extension on that platform.
     15
     16        * platform/graphics/angle/ExtensionsGLANGLE.cpp:
     17        (WebCore::ExtensionsGLANGLE::ensureEnabled):
     18        (WebCore::ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat):
     19        * platform/graphics/angle/ExtensionsGLANGLE.h:
     20        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
     21        (WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
     22
    1232020-05-15  Oriol Brufau  <obrufau@igalia.com>
    224
  • trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp

    r260908 r261769  
    8888        gl::RequestExtensionANGLE(name.ascii().data());
    8989        m_enabledExtensions.add(name);
     90
     91        if (name == "GL_CHROMIUM_color_buffer_float_rgba"_s)
     92            m_webglColorBufferFloatRGBA = true;
     93        else if (name == "GL_CHROMIUM_color_buffer_float_rgb"_s)
     94            m_webglColorBufferFloatRGB = true;
    9095    }
    9196}
     
    250255{
    251256    // The implementation of WEBGL_color_buffer_float for WebGL 1.0 / ES 2.0 requires a sized
    252     // internal format. Adjust it if necessary at this lowest level. Note that it does not matter at
    253     // this point whether the WEBGL_color_buffer_float extension has actually been enabled at higher
    254     // levels; the enum will be valid or invalid either way.
     257    // internal format. Adjust it if necessary at this lowest level.
    255258    if (type == GL_FLOAT) {
    256         if (format == GL_RGBA && internalformat == GL_RGBA)
     259        if (m_webglColorBufferFloatRGBA && format == GL_RGBA && internalformat == GL_RGBA)
    257260            return GL_RGBA32F;
    258         if (format == GL_RGB && internalformat == GL_RGB)
     261        if (m_webglColorBufferFloatRGB && format == GL_RGB && internalformat == GL_RGB)
    259262            return GL_RGB32F;
    260263    }
  • trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.h

    r260908 r261769  
    149149
    150150    // Only for non-WebGL 2.0 contexts.
    151     static GCGLenum adjustWebGL1TextureInternalFormat(GCGLenum internalformat, GCGLenum format, GCGLenum type);
     151    GCGLenum adjustWebGL1TextureInternalFormat(GCGLenum internalformat, GCGLenum format, GCGLenum type);
    152152
    153153private:
     
    175175    String m_vendor;
    176176    String m_renderer;
     177
     178    // Whether the WebGL 1.0-related floating-point renderability extensions have been enabled.
     179    bool m_webglColorBufferFloatRGB { false };
     180    bool m_webglColorBufferFloatRGBA { false };
    177181};
    178182
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp

    r261639 r261769  
    18891889{
    18901890    makeContextCurrent();
    1891     if (!m_isForWebGL2)
    1892         internalformat = ExtensionsGLANGLE::adjustWebGL1TextureInternalFormat(internalformat, format, type);
     1891    if (!m_isForWebGL2 && m_extensions)
     1892        internalformat = m_extensions->adjustWebGL1TextureInternalFormat(internalformat, format, type);
    18931893    gl::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
    18941894    m_state.textureSeedCount.add(m_state.currentBoundTexture());
Note: See TracChangeset for help on using the changeset viewer.