Bug 212271 - [ANGLE - iOS] fast/canvas/webgl/webgl-depth-texture.html is failing
Summary: [ANGLE - iOS] fast/canvas/webgl/webgl-depth-texture.html is failing
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords: InRadar
Depends on: 212461
Blocks: 207858 212251 212284
  Show dependency treegraph
 
Reported: 2020-05-22 11:37 PDT by Justin Fan
Modified: 2020-05-28 12:53 PDT (History)
7 users (show)

See Also:


Attachments
Patch (22.11 KB, patch)
2020-05-22 13:38 PDT, Kenneth Russell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Fan 2020-05-22 11:37:02 PDT
on iOS/Simulator, fast/canvas/webgl/webgl-depth-texture.html fails. an error check after a call to texImage2D to initialize an unsigned short depth texture fails with INVALID_OPERATION; either the call is failing, or some error state is not being cleared properly.
Comment 1 Radar WebKit Bug Importer 2020-05-22 11:37:21 PDT
<rdar://problem/63547935>
Comment 2 Kenneth Russell 2020-05-22 12:07:52 PDT
I'll investigate.
Comment 3 Kenneth Russell 2020-05-22 12:22:58 PDT
Can see that ToT WebKit on macOS passes the test, and that ToT WebKit on the simulator fails.

Interestingly, ToT Chrome (Canary) fails this test, but passes Khronos' upstream version of the test:
https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/webgl-depth-texture.html

Continuing to investigate. Likely, some translation of depth texture enums will have to occur inside ANGLE in order to run on iOS's ES 3.0 driver.

Start of the output of the test on the iPad simulator:

PASS WebGL context exists
Testing binding enum with extension disabled
PASS gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_ENUM.
PASS gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null) generated expected GL error: INVALID_ENUM.
PASS Successfully enabled WEBGL_depth_texture extension
PASS WEBGL_depth_texture listed as supported and getExtension succeeded
Testing WEBGL_depth_texture

testing: UNSIGNED_SHORT
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_2D, 1, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1, 1, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, new Uint16Array(1)) generated expected GL error: INVALID_OPERATION.
PASS gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, canvas2) generated one of expected GL errors: INVALID_VALUE or INVALID_ENUM or INVALID_OPERATION.
PASS gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 0, 0, 1, 1, 0) generated one of expected GL errors: INVALID_ENUM or INVALID_OPERATION.
FAIL gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 8, 8, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null) expected: NO_ERROR. Was INVALID_OPERATION.
PASS gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, new Uint16Array(1)) generated expected GL error: INVALID_OPERATION.
FAIL gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1) expected: INVALID_OPERATION. Was INVALID_VALUE.
PASS gl.generateMipmap(gl.TEXTURE_2D) generated expected GL error: INVALID_OPERATION.
FAIL gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36054.
FAIL actual(0) < left(0)
FAIL actual(0) < left(0)
FAIL actual(0) < left(0)
FAIL actual(0) < left(0)
FAIL actual(0) < left(0)
FAIL actual(0) < left(0)
...
Comment 4 Kenneth Russell 2020-05-22 12:41:31 PDT
The OpenGL ES driver's returning INVALID_OPERATION from the functions->texImage2D call inside TextureGL::setImageHelper:

#0	0x00000006af309189 in rx::CheckError(gl::Context const*, char const*, char const*, char const*, unsigned int) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp:1955
#1	0x00000006af3f776d in rx::TextureGL::setImageHelper(gl::Context const*, gl::TextureTarget, unsigned long, unsigned int, gl::Extents const&, unsigned int, unsigned int, unsigned char const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp:254
#2	0x00000006af3f6900 in rx::TextureGL::setImage(gl::Context const*, gl::ImageIndex const&, unsigned int, gl::Extents const&, unsigned int, unsigned int, gl::PixelUnpackState const&, unsigned char const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp:220
#3	0x00000006af3f09be in gl::Texture::setImage(gl::Context*, gl::PixelUnpackState const&, gl::TextureTarget, int, unsigned int, gl::Extents const&, unsigned int, unsigned int, unsigned char const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp:1062
#4	0x00000006aef3be9e in gl::Context::texImage2D(gl::TextureTarget, int, int, int, int, int, unsigned int, unsigned int, void const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp:4008
#5	0x00000006aef3bfef in gl::Context::texImage2DRobust(gl::TextureTarget, int, int, int, int, int, unsigned int, unsigned int, int, void const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp:4025
#6	0x00000006af05c97c in gl::TexImage2DRobustANGLE(unsigned int, int, int, int, int, int, unsigned int, unsigned int, int, void const*) at /Users/kbr/src/iOSWebKit/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_ext_autogen.cpp:1187
#7	0x00000006aa6f2e3e in WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE(unsigned int, int, int, int, int, int, unsigned int, unsigned int, int, void const*) at /Users/kbr/src/iOSWebKit/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp:352


The arguments to the call to the driver are:

glTexImage2D(GL_TEXTURE_2D, /* level */ 0, GL_DEPTH_COMPONENT, 8, 8, /* border */ 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, nullptr);
Comment 5 Kenneth Russell 2020-05-22 13:38:42 PDT
Created attachment 400072 [details]
Patch
Comment 6 EWS Watchlist 2020-05-22 13:39:25 PDT
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE
Comment 7 Kenneth Russell 2020-05-22 13:40:13 PDT
Emulation of the unsized internal formats for depth/stencil textures - provided by the OES_depth_texture extension on ES 3.0 - on top of ES 3.0's sized internal formats for these textures seems required in ANGLE.

The attached patch makes fast/canvas/webgl/webgl-depth-texture.html pass completely in the iOS Simulator. Will have to do more testing upstream in ANGLE to see whether it's completely correct on all platforms.
Comment 8 EWS 2020-05-22 14:30:34 PDT
Committed r262074: <https://trac.webkit.org/changeset/262074>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400072 [details].
Comment 9 Kenneth Russell 2020-05-22 16:11:38 PDT
ios-wk2 failure of webgl/1.0.3/conformance/extensions/webgl-depth-texture.html handled in follow-on Bug 212284, removing the failure expectations for this test on iOS.