Changeset 261975 in webkit


Ignore:
Timestamp:
May 20, 2020 5:16:47 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator with ANGLE
https://bugs.webkit.org/show_bug.cgi?id=210524

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

Source/ThirdParty/ANGLE:

Emulate LUMINANCE, ALPHA and LUMINANCE_ALPHA floating-point
textures on top of RED / RG textures when the underlying
OES_texture_float/half_float OpenGL ES extensions are unavailable.

This makes the conformance/extensions/oes-texture{-half}-float*
tests run and pass in the iOS Simulator.

This change is being reviewed upstream in the ANGLE repository and
is only being uploaded here for testing purposes. It will be
rolled in with the next ANGLE update.

  • src/libANGLE/renderer/gl/TextureGL.cpp:

(rx::TextureGL::setSwizzle):

  • src/libANGLE/renderer/gl/formatutilsgl.cpp:

(rx::nativegl::BuildInternalFormatInfoMap):
(rx::nativegl::IsLUMAFormat):
(rx::nativegl::EmulateLUMAFormat):
(rx::nativegl::EmulateLUMA):
(rx::nativegl::GetNativeInternalFormat):
(rx::nativegl::GetNativeFormat):
(rx::nativegl::GetNativeType):
(rx::nativegl::GetTexImageFormat):
(rx::nativegl::GetTexSubImageFormat):

LayoutTests:

Remove expected failure for
webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt
on ios-simulator. Enable
fast/canvas/webgl/oes-texture-half-float-uint16.html on iOS.

  • platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt: Removed.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261973 r261975  
     12020-05-20  Kenneth Russell  <kbr@chromium.org>
     2
     3        OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator with ANGLE
     4        https://bugs.webkit.org/show_bug.cgi?id=210524
     5
     6        Reviewed by Dean Jackson.
     7
     8        Remove expected failure for
     9        webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt
     10        on ios-simulator. Enable
     11        fast/canvas/webgl/oes-texture-half-float-uint16.html on iOS.
     12
     13        * platform/ios-simulator/webgl/2.0.0/conformance/extensions/oes-texture-float-expected.txt: Removed.
     14        * platform/ios/TestExpectations:
     15
    1162020-05-20  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/LayoutTests/platform/ios/TestExpectations

    r261946 r261975  
    34703470webkit.org/b/207858 webgl/webgl-border.html [ Pass Failure ImageOnlyFailure ]
    34713471webkit.org/b/207858 webgl/webgl-box-shadow.html [ Pass Failure ImageOnlyFailure ]
    3472 webkit.org/b/207858 fast/canvas/webgl/oes-texture-half-float-uint16.html [ Pass Failure ]
    34733472webkit.org/b/207858 fast/canvas/webgl/program-test.html [ Failure ]
    34743473webkit.org/b/207858 fast/canvas/webgl/uninitialized-test.html [ Pass Failure ]
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r261844 r261975  
     12020-05-20  Kenneth Russell  <kbr@chromium.org>
     2
     3        OES_texture_float / OES_texture_half_float unavailable in WebGL 1.0 on iOS Simulator with ANGLE
     4        https://bugs.webkit.org/show_bug.cgi?id=210524
     5
     6        Reviewed by Dean Jackson.
     7
     8        Emulate LUMINANCE, ALPHA and LUMINANCE_ALPHA floating-point
     9        textures on top of RED / RG textures when the underlying
     10        OES_texture_float/half_float OpenGL ES extensions are unavailable.
     11
     12        This makes the conformance/extensions/oes-texture{-half}-float*
     13        tests run and pass in the iOS Simulator.
     14
     15        This change is being reviewed upstream in the ANGLE repository and
     16        is only being uploaded here for testing purposes. It will be
     17        rolled in with the next ANGLE update.
     18
     19        * src/libANGLE/renderer/gl/TextureGL.cpp:
     20        (rx::TextureGL::setSwizzle):
     21        * src/libANGLE/renderer/gl/formatutilsgl.cpp:
     22        (rx::nativegl::BuildInternalFormatInfoMap):
     23        (rx::nativegl::IsLUMAFormat):
     24        (rx::nativegl::EmulateLUMAFormat):
     25        (rx::nativegl::EmulateLUMA):
     26        (rx::nativegl::GetNativeInternalFormat):
     27        (rx::nativegl::GetNativeFormat):
     28        (rx::nativegl::GetNativeType):
     29        (rx::nativegl::GetTexImageFormat):
     30        (rx::nativegl::GetTexSubImageFormat):
     31
    1322020-05-18  James Darpinian  <jdarpinian@chromium.org>
    233
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp

    r261750 r261975  
    16111611
    16121612        stateManager->bindTexture(getType(), mTextureID);
    1613         ANGLE_GL_TRY(context, functions->texParameteriv(ToGLenum(getType()),
    1614                                                         GL_TEXTURE_SWIZZLE_RGBA, swizzle));
     1613        if (functions->standard == STANDARD_GL_ES)
     1614        {
     1615            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
     1616                                                           GL_TEXTURE_SWIZZLE_R, swizzle[0]));
     1617            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
     1618                                                           GL_TEXTURE_SWIZZLE_G, swizzle[1]));
     1619            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
     1620                                                           GL_TEXTURE_SWIZZLE_B, swizzle[2]));
     1621            ANGLE_GL_TRY(context, functions->texParameteri(ToGLenum(getType()),
     1622                                                           GL_TEXTURE_SWIZZLE_A, swizzle[3]));
     1623        }
     1624        else
     1625        {
     1626            ANGLE_GL_TRY(context, functions->texParameteriv(ToGLenum(getType()),
     1627                                                            GL_TEXTURE_SWIZZLE_RGBA, swizzle));
     1628        }
    16151629    }
    16161630    return angle::Result::Continue;
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp

    r261750 r261975  
    276276
    277277    // Luminance alpha formats
    278     //                       | Format                  | OpenGL texture support                      | Filter           | Render          | OpenGL ES texture support            | Filter                                      | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
    279     InsertFormatMapping(&map, GL_ALPHA8_EXT,             AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
    280     InsertFormatMapping(&map, GL_LUMINANCE8_EXT,         AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
    281     InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT,  AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                     AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
    282     InsertFormatMapping(&map, GL_ALPHA16F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
    283     InsertFormatMapping(&map, GL_LUMINANCE16F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
    284     InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
    285     InsertFormatMapping(&map, GL_ALPHA32F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
    286     InsertFormatMapping(&map, GL_LUMINANCE32F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
    287     InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
     278    //                      | Format                   | OpenGL texture support                     | Filter           | Render          | OpenGL ES texture support                       | Filter                                      | OpenGL ES texture attachment support | OpenGL ES renderbuffer support |
     279    InsertFormatMapping(&map, GL_ALPHA8_EXT,             AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
     280    InsertFormatMapping(&map, GL_LUMINANCE8_EXT,         AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
     281    InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT,  AlwaysSupported(),                           AlwaysSupported(), NeverSupported(), AlwaysSupported(),                                AlwaysSupported(),                            NeverSupported(),                      NeverSupported()                );
     282    InsertFormatMapping(&map, GL_ALPHA16F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
     283    InsertFormatMapping(&map, GL_LUMINANCE16F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
     284    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_half_float"), ExtsOnly("GL_OES_texture_half_float_linear"), NeverSupported(),                      NeverSupported()                );
     285    InsertFormatMapping(&map, GL_ALPHA32F_EXT,           VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
     286    InsertFormatMapping(&map, GL_LUMINANCE32F_EXT,       VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
     287    InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), VersionOrExts(3, 0, "GL_OES_texture_float"),      ExtsOnly("GL_OES_texture_float_linear"),      NeverSupported(),                      NeverSupported()                );
    288288
    289289    // EXT_texture_compression_rgtc formats
     
    435435}
    436436
     437static bool IsLUMAFormat(GLenum format)
     438{
     439    return (format == GL_LUMINANCE || format == GL_ALPHA || format == GL_LUMINANCE_ALPHA);
     440}
     441
     442static GLenum EmulateLUMAFormat(const GLenum format)
     443{
     444    // This is needed separately from EmulateLUMA because some format/type combinations that come in
     445    // to GetNativeFormat don't have entries in the internal format map.
     446
     447    ASSERT(IsLUMAFormat(format));
     448
     449    if (format == GL_LUMINANCE || format == GL_ALPHA)
     450        return GL_RED;
     451
     452    return GL_RG;
     453}
     454
     455static const gl::InternalFormat &EmulateLUMA(const gl::InternalFormat &internalFormat)
     456{
     457    ASSERT(IsLUMAFormat(internalFormat.format));
     458
     459    // Work around deprecated luminance/alpha formats in the OpenGL core profile, and OpenGL ES 3.0
     460    // and greater, by backing them with R or RG textures.
     461    return gl::GetInternalFormatInfo(EmulateLUMAFormat(internalFormat.format), internalFormat.type);
     462}
     463
    437464static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
    438465                                      const angle::FeaturesGL &features,
     
    480507        if ((functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0)
    481508        {
    482             // Work around deprecated luminance alpha formats in the OpenGL core profile by backing
    483             // them with R or RG textures.
    484             if (internalFormat.format == GL_LUMINANCE || internalFormat.format == GL_ALPHA)
     509            if (IsLUMAFormat(internalFormat.format))
    485510            {
    486                 result = gl::GetInternalFormatInfo(GL_RED, internalFormat.type).sizedInternalFormat;
     511                result = EmulateLUMA(internalFormat).sizedInternalFormat;
    487512            }
    488 
    489             if (internalFormat.format == GL_LUMINANCE_ALPHA)
     513        }
     514    }
     515    else if (functions->isAtLeastGLES(gl::Version(3, 0)))
     516    {
     517        if (internalFormat.componentType == GL_FLOAT)
     518        {
     519            if (!internalFormat.isLUMA())
    490520            {
    491                 result = gl::GetInternalFormatInfo(GL_RG, internalFormat.type).sizedInternalFormat;
     521                // Use sized internal formats for floating point textures.  Extensions such as
     522                // EXT_color_buffer_float require the sized formats to be renderable.
     523                result = internalFormat.sizedInternalFormat;
    492524            }
    493         }
    494     }
    495     else if (functions->isAtLeastGLES(gl::Version(3, 0)))
    496     {
    497         if (internalFormat.componentType == GL_FLOAT && !internalFormat.isLUMA())
    498         {
    499             // Use sized internal formats for floating point textures.  Extensions such as
    500             // EXT_color_buffer_float require the sized formats to be renderable.
    501             result = internalFormat.sizedInternalFormat;
     525            else if ((internalFormat.type == GL_FLOAT &&
     526                      !functions->hasGLESExtension("GL_OES_texture_float")) ||
     527                     (internalFormat.type == GL_HALF_FLOAT_OES &&
     528                      !functions->hasGLESExtension("GL_OES_texture_half_float")))
     529            {
     530                // The legacy luminance/alpha formats from OES_texture_float are emulated with R/RG
     531                // textures.
     532                if (IsLUMAFormat(internalFormat.format))
     533                {
     534                    result = EmulateLUMA(internalFormat).sizedInternalFormat;
     535                }
     536            }
    502537        }
    503538        else if (internalFormat.format == GL_RED_EXT || internalFormat.format == GL_RG_EXT)
     
    520555static GLenum GetNativeFormat(const FunctionsGL *functions,
    521556                              const angle::FeaturesGL &features,
    522                               GLenum format)
     557                              GLenum format,
     558                              GLenum type)
    523559{
    524560    GLenum result = format;
     
    542578            // Work around deprecated luminance alpha formats in the OpenGL core profile by backing
    543579            // them with R or RG textures.
    544             if (format == GL_LUMINANCE || format == GL_ALPHA)
     580            if (IsLUMAFormat(format))
    545581            {
    546                 result = GL_RED;
    547             }
    548 
    549             if (format == GL_LUMINANCE_ALPHA)
    550             {
    551                 result = GL_RG;
     582                result = EmulateLUMAFormat(format);
    552583            }
    553584        }
     
    567598            }
    568599        }
     600
     601        if ((type == GL_FLOAT && !functions->hasGLESExtension("GL_OES_texture_float")) ||
     602            (type == GL_HALF_FLOAT_OES &&
     603             !functions->hasGLESExtension("GL_OES_texture_half_float")))
     604        {
     605            // On ES 3.0 systems that don't have GL_OES_texture_float or OES_texture_half_float, the
     606            // LUMINANCE/ALPHA formats from those extensions must be emulated with R/RG textures.
     607            if (IsLUMAFormat(format))
     608            {
     609                result = EmulateLUMAFormat(format);
     610            }
     611        }
    569612    }
    570613
     
    630673        if (type == GL_HALF_FLOAT_OES)
    631674        {
    632             switch (format)
     675            if (!IsLUMAFormat(format) || !functions->hasGLESExtension("GL_OES_texture_half_float"))
    633676            {
    634                 case GL_LUMINANCE_ALPHA:
    635                 case GL_LUMINANCE:
    636                 case GL_ALPHA:
    637                     // In ES3, these formats come from EXT_texture_storage, which uses
    638                     // HALF_FLOAT_OES. Other formats (like RGBA) use HALF_FLOAT (non-OES) in ES3.
    639                     break;
    640 
    641                 default:
    642                     result = GL_HALF_FLOAT;
    643                     break;
     677                // In ES3, the luminance formats come from OES_texture_half_float, which uses
     678                // HALF_FLOAT_OES. Other formats (like RGBA) use HALF_FLOAT (non-OES) in ES3.
     679                // If they're emulated (see above), use HALF_FLOAT.
     680                result = GL_HALF_FLOAT;
    644681            }
    645682        }
     
    702739    result.internalFormat = GetNativeInternalFormat(
    703740        functions, features, gl::GetInternalFormatInfo(internalFormat, type));
    704     result.format = GetNativeFormat(functions, features, format);
     741    result.format = GetNativeFormat(functions, features, format, type);
    705742    result.type   = GetNativeType(functions, features, format, type);
    706743    return result;
     
    713750{
    714751    TexSubImageFormat result;
    715     result.format = GetNativeFormat(functions, features, format);
     752    result.format = GetNativeFormat(functions, features, format, type);
    716753    result.type   = GetNativeType(functions, features, format, type);
    717754    return result;
Note: See TracChangeset for help on using the changeset viewer.