Open Bug 1645478 Opened 5 years ago Updated 1 year ago

Refactor/remove the lookback count threshold in WebRender

Categories

(Core :: Graphics: WebRender, task)

task

Tracking

()

People

(Reporter: kvark, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 obsolete file)

The threshold doesn't properly reflect the constraints we are dealing with

  • it should be different for opaque versus transparent, since for opaque we are sacrificing the fill rate and fragment executions (see bug 1645454)
  • it should be much higher for the transparent pass, since we often hit the case where the draw call number explodes
  • it tries to approximate the CPU work, while it's mostly constrained by the renctangle intersections, which can have any number per batch

An approach that I want to explore is reversing the problem a bit. Instead of going back and finding the closest key that is compatible, keep track of the association of some batch keys to last batch numbers. Then the batching problem is transformed from "how far we go" to whether batches in this set intersect with our batch. Since it's a more focused algorithmic problem, it's simpler to optimize.

The tricky aspect here is that batch keys are not compared for exact equality. Instead they are compared for "compatibility". For instance, if the next instance doesn't care what texture is bound at slot 1, it is compatible with keys that have some textures in slot 1.

Attached file Reverse the WR batch lookup logic (obsolete) —

this PR avoids our lookup function to go and compare each batch key.
Instead, we keep a map around to know which keys were observed, and when.
This makes it trivial to find the batch index candidate. The only task left
is checking all intersections with the batch rectangles in-between.

The lookup is based on the assumption that doing a strict comparison of BatchKey
is producing the same result as calling is_compatible on it. The assumption
follows the idea that in all the cases where batch textures are compatible but
different, the batch kinds would also be different.

The change is only affecting alpha batches, for now. Opaque is to be followed up.
It happens to make the set_params_and_get_batch() function much simpler.

Assignee: nobody → dmalyshau
Status: NEW → ASSIGNED
Attachment #9156394 - Attachment is obsolete: true

Looks like we are still using the lookback of 10 (BATCH_LOOKBACK_COUNT).

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: dmalyshau → nobody
Status: ASSIGNED → NEW
Blocks: wr-todos
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: