Bug 192314 - [WinCairo] Enable WebGL 2
Summary: [WinCairo] Enable WebGL 2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
: 220098 (view as bug list)
Depends on: 219421
Blocks:
  Show dependency treegraph
 
Reported: 2018-12-03 11:11 PST by Don Olmstead
Modified: 2020-12-23 12:20 PST (History)
17 users (show)

See Also:


Attachments
WIP patch (9.38 KB, patch)
2020-11-24 13:27 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP patch (5.67 KB, patch)
2020-11-27 22:38 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP patch (19.88 KB, patch)
2020-12-01 20:13 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
WIP patch (1.19 KB, patch)
2020-12-16 22:17 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
The failure result of tex-2d-r16f-red-float.html (16.18 KB, text/plain)
2020-12-21 12:53 PST, Fujii Hironori
no flags Details
layout-test-results for image_bitmap_from_canvas (522.76 KB, application/x-zip-compressed)
2020-12-21 13:29 PST, Fujii Hironori
no flags Details
run-webkit-tests output for image_bitmap_from_canvas (8.39 KB, text/plain)
2020-12-21 13:32 PST, Fujii Hironori
no flags Details
simplified tex-2d-rgba16f-rgba-float.html (176.51 KB, text/html)
2020-12-21 18:56 PST, Fujii Hironori
no flags Details
simplified tex-2d-rgba16f-rgba-float.html (176.51 KB, text/html)
2020-12-21 20:52 PST, Fujii Hironori
no flags Details
WIP patch (12.19 KB, patch)
2020-12-22 19:42 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (14.25 KB, patch)
2020-12-22 23:29 PST, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2018-12-03 11:11:53 PST
OpenGL ES3 support is there in ANGLE so we can enable WebGL 2 for windows.
Comment 1 Fujii Hironori 2020-11-24 13:27:51 PST
Created attachment 414850 [details]
WIP patch
Comment 2 Fujii Hironori 2020-11-27 22:38:48 PST
Created attachment 414973 [details]
WIP patch
Comment 3 Fujii Hironori 2020-12-01 20:13:42 PST
Created attachment 415189 [details]
WIP patch
Comment 4 Fujii Hironori 2020-12-16 22:17:02 PST
Created attachment 416390 [details]
WIP patch

A lot of tests are failing under webgl/2.0.0/conformance2/textures, for example,

  webgl/2.0.0/conformance2/textures/image_bitmap_from_image/tex-2d-r16f-red-float.html [ Failure ]
  webgl/2.0.0/conformance2/textures/image_bitmap_from_image/tex-2d-r16f-red-half_float.html [ Failure ]
  webgl/2.0.0/conformance2/textures/image_bitmap_from_image/tex-2d-r32f-red-float.html [ Failure ]
  webgl/2.0.0/conformance2/textures/image_bitmap_from_image/tex-2d-r8-red-unsigned_byte.html [ Failure ]
Comment 5 Kenneth Russell 2020-12-17 16:43:06 PST
Several bug fixes made all of the ImageBitmap tests pass on Apple's port. Is platform-specific code needed to make ImageBitmap work correctly on WinCairo?
Comment 6 Fujii Hironori 2020-12-17 18:08:10 PST
Thanks, Ken. I don't know the answer. Will check.
Comment 7 Fujii Hironori 2020-12-20 23:04:29 PST
(In reply to Fujii Hironori from comment #4)
> A lot of tests are failing under webgl/2.0.0/conformance2/textures, for
> example,

Only texSubImage2D[SubSource] tests are failing.
There are suspicious FIXME comments in WebGLRenderingContextBase::texImageSourceHelper for Cairo ports.

> // FIXME: Enable this path with ANGLE. Only used with Cairo, not on macOS or iOS.
> // If possible, copy from the bitmap directly to the texture
> // via the GPU, without a read-back to system memory.
> //
> // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when
> // ImageBuffer::copyToPlatformTexture implementations are fully functional.
Comment 8 Kenneth Russell 2020-12-21 11:59:31 PST
(In reply to Fujii Hironori from comment #7)
> (In reply to Fujii Hironori from comment #4)
> > A lot of tests are failing under webgl/2.0.0/conformance2/textures, for
> > example,
> 
> Only texSubImage2D[SubSource] tests are failing.
> There are suspicious FIXME comments in
> WebGLRenderingContextBase::texImageSourceHelper for Cairo ports.
> 
> > // FIXME: Enable this path with ANGLE. Only used with Cairo, not on macOS or iOS.
> > // If possible, copy from the bitmap directly to the texture
> > // via the GPU, without a read-back to system memory.
> > //
> > // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when
> > // ImageBuffer::copyToPlatformTexture implementations are fully functional.

Ah, yes. That code path tries to handle the case where the ImageBitmap is backed by a GPU texture, and tries to copy it directly to the destination WebGL texture.

Could you see whether the extension in Source/ThirdParty/ANGLE/extensions/CHROMIUM_copy_texture.txt provides the needed functionality, and lets you skip the query of the texture's internal format? With the ANGLE backend, WebGLTextures don't track their internal format any more.

Note, I would have thought that the fall-through case (which uses CPU readbacks) would have at least made the tests pass, even if they're slower than desired. Could you investigate exactly what's going wrong with the texSubImage2D[SubSource] tests?
Comment 9 Fujii Hironori 2020-12-21 12:53:27 PST
Created attachment 416623 [details]
The failure result of tex-2d-r16f-red-float.html

This is a result of webgl/2.0.0/resources/webgl_test_files/conformance2/textures/image_bitmap_from_canvas/tex-2d-r16f-red-float.html.
There are 8 texSubImage2D[SubSource] tests, and all are failing.
There are 10 FAILs, all expected black but red.

I guess this is a SubSource dimension issue because other tests are passing. my two cents.
Comment 10 Fujii Hironori 2020-12-21 13:08:31 PST
(In reply to Kenneth Russell from comment #8)
> Could you see whether the extension in
> Source/ThirdParty/ANGLE/extensions/CHROMIUM_copy_texture.txt provides the
> needed functionality,

I have to admit I don't understand. How to check it?

> and lets you skip the query of the texture's internal
> format? With the ANGLE backend, WebGLTextures don't track their internal
> format any more.

How to skip?
Comment 11 Fujii Hironori 2020-12-21 13:29:09 PST
Created attachment 416626 [details]
layout-test-results for image_bitmap_from_canvas

This is layout-test-results for the following command.
> python ./Tools/Scripts/run-webkit-tests --debug  --wincairo --no-new-test-results --no-retry-failures webgl/2.0.0/conformance2/textures/image_bitmap_from_canvas -1
Comment 12 Fujii Hironori 2020-12-21 13:32:26 PST
Created attachment 416627 [details]
run-webkit-tests output for image_bitmap_from_canvas

> 16 tests ran as expected, 50 didn't:
Comment 13 Fujii Hironori 2020-12-21 14:05:09 PST
(In reply to Fujii Hironori from comment #12)
> > 16 tests ran as expected, 50 didn't:

I seems that only WebGL1 compatible pixel formats are passing.
I'm initializing WebGL2 ANGLE context with a sharing context with TextureMapper to composite.
It's suspicious.
Comment 14 Fujii Hironori 2020-12-21 16:44:25 PST
I tried both disabling sharing a context and using ES v3 for compositing, but no luck. 🤷‍♂️
Comment 15 Fujii Hironori 2020-12-21 18:56:36 PST
Created attachment 416646 [details]
simplified tex-2d-rgba16f-rgba-float.html

1. Start WinCairo MiniBroser
2. Open tex-2d-rgba16f-rgba-float.html
3. All tests pass
4. Reload
5. The third test fails
Comment 16 Fujii Hironori 2020-12-21 20:52:09 PST
Created attachment 416649 [details]
simplified tex-2d-rgba16f-rgba-float.html
Comment 17 Fujii Hironori 2020-12-22 12:33:06 PST
Filed the issue as a new bug:  Bug 220098 – [WinCairo][WebGL2] webgl/2.0.0/conformance2/textures tests are failing
Comment 18 Fujii Hironori 2020-12-22 17:04:55 PST
*** Bug 220098 has been marked as a duplicate of this bug. ***
Comment 19 Fujii Hironori 2020-12-22 19:42:16 PST
Created attachment 416702 [details]
WIP patch
Comment 20 Fujii Hironori 2020-12-22 23:29:20 PST
Created attachment 416704 [details]
Patch
Comment 21 Kenneth Russell 2020-12-23 10:05:58 PST
Comment on attachment 416704 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416704&action=review

Hooray! Glad this is working! r+

> Source/WebCore/platform/graphics/texmap/ANGLEContext.cpp:133
> +    contextAttributes.append(EGL_FALSE);

Per your comment on https://bugs.webkit.org/show_bug.cgi?id=220098 - if you can find a way to refactor this ANGLE EGL context initialization code so it can be shared among all ports, that would be very welcome.
Comment 22 Fujii Hironori 2020-12-23 12:06:36 PST
Comment on attachment 416704 [details]
Patch

Clearing flags on attachment: 416704

Committed r271075: <https://trac.webkit.org/changeset/271075>
Comment 23 Fujii Hironori 2020-12-23 12:06:40 PST
All reviewed patches have been landed.  Closing bug.
Comment 24 Radar WebKit Bug Importer 2020-12-23 12:07:19 PST
<rdar://problem/72631792>
Comment 25 Fujii Hironori 2020-12-23 12:20:10 PST
I was motivated by your presentation in the WebKit contributors
conference. I'm so happy that WinCairo also enables WebGL2 today.
Thank you very much for the review and assistance.