Closed Bug 1679480 (sw-wr-perf-d3d11-webgl) Opened 4 years ago Closed 4 years ago

RenderCompositorD3D11SWGL does not use external compositing for WebGL rendering(sw-wr)

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: sotaro, Assigned: gw)

References

(Blocks 2 open bugs)

Details

When WebGL page like the following was shown, RenderCompositorD3D11SWGL did not use external compositing.

Then WebGL texture data was read back with RenderDXGITextureHost::MapPlane().

Blocks: sw-wr-perf

It seems that external compositing seems to need, both aPreferCompositorSurface=true and aSupportsExternalCompositing=true at DisplayListBuilder::PushImage().

But aPreferCompositorSurface=true is set only when Texture format or TextureFlags::IS_OPAQUE flag is necessary.

With WebGL, texture format is always BGRA

And TextureFlags::IS_OPAQUE flag is not set by default, since WebGLContextOptions::alpha is true by default.

Then when content does not set WebGLContextOptions::alpha=false, WebGL content texture is not opaque.

:gw, is it possible to enable external compositing at WebRender even when WebGL content texture is not opaque?

Flags: needinfo?(gwatson)

The current code for creating external compositor surfaces requires them to be opaque, so that they can be drawn underneath the transparent picture cache tiles, which will only contain content above the external surface (since everything behind will have been occluded).

Allowing transparent external surfaces will mean we could require transparent picture cache tiles both in front and behind the external surface in order to render correctly.

I think a lot of WebGL content uses helper libraries which switch the default to not having alpha, so a lot of games etc will be opaque. If you think the transparent case is common, then maybe we should prioritize fixing this.

Blocks: gfx-triage
Flags: needinfo?(gwatson)
No longer blocks: gfx-triage
Severity: -- → S3
Priority: -- → P3

It seems necessary for Software WebRender with Compositor on Android. fps of WebGL Aquarium was not good with Software WebRender with Compositor on Android.
https://webglsamples.org/aquarium/aquarium.html

:gw, can you advice how external compositing support of non-opaque surface could be added to WebRender?

Flags: needinfo?(gwatson)

What we need to do is add z-ordering support to tiles in picture cache code for tiles within a single slice. This is conceptually easy to do, but is a bit involved due to the current picture cache dependency code assuming that tiles within a slice don't overlap at all, so needs a bit of refactoring.

I am planning to work in the next month or so on refactoring how picture caches store primitive dependencies, so I could include support for this functionality as part of that refactoring.

Jim, do we have a high priority on this, or is it fine to do as part of the prim dependency refactoring work we've discussed previously?

Flags: needinfo?(gwatson) → needinfo?(jmathies)

I guess it depends on how badly we need the perf improvements to ship sw-wr on Android. Lets chat in the triage meeting.

Blocks: gfx-triage
Flags: needinfo?(jmathies)
Assignee: nobody → gwatson
No longer blocks: gfx-triage
No longer blocks: sw-wr-android
Blocks: 1699588
Depends on: 1699603
Blocks: 1700966
Alias: sw-wr-perf-d3d11-webgl
Depends on: 1703737, 1703731
Depends on: 1704655
Depends on: 1704662
Depends on: 1704687, 1704694
Depends on: 1704944
Depends on: 1704951
Depends on: 1704956
Depends on: 1705979
Depends on: 1706198
Depends on: 1706488
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.