Closed Bug 1585716 Opened 5 years ago Closed 3 years ago

Use geometry shader path with layer selection for WebRender picture cache tiles updates

Categories

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

enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kvark, Unassigned)

References

(Blocks 1 open bug)

Details

Problem

Currently, when a picture cache tile needs to be invalidated, we bind it as a separate target and draw the opaque + alpha primitives into it. In fact, we do this for every dirty sub-region of a tile.

When we are in a situation where multiple tiles need to be invalidated, and primitives are large enough to cover multiple tiles, we end up with a lot of draw calls (since each tile is updated individually). From the user perspective, this results in a "hitch", say when scrolling, since our Renderer spends a lot of CPU time together with the OpenGL/D3D driver to submit the draw calls.

Solution proposed

Have a single framebuffer with the attachment that is a 2D array of tiles. The draw calls for all dirty tile updates would then be mixed all together and batched properly.

In order to select the destination layer, we'd introduce the geometry shading stage, where gl_Layer is available.

As a benefit of having a per-primitive stage, we can move the fetching of all primitive data from VS to GS (GPU cache, primitive headers, render task data, etc), leaving the VS stage to just propagate the instance data forward.

Pros:

  • very good batching and low CPU overhead to update multiple tiles, helps improving the behavior in tough situations for current WR
  • may speed up the vertex processing a bit, since the GPU structures would only be accessed once per primitive instead of once per vertex

Cons:

  • more work for us
  • more shaders are needed: some will be with and without the geometry stage, which may slow down the startup a bit (remains to be measured)
  • may slow down the vertex processing a bit, since geometry shaders are known to be slow in general
Priority: -- → P3
Blocks: wr-perf

Picture cache tiles are moving to regular (non-array) textures.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.