Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Display list culling prototype based on op indices #38304

Closed
wants to merge 5 commits into from

Conversation

flar
Copy link
Contributor

@flar flar commented Dec 15, 2022

This is a variant of #38189 that uses indices of the ops rather than offsets into the buffer, to control which ops re rendered or culled. The description that follows is essentially the same as the other PR.

This PR creates the underpinnings for a mechanism that can be used to cull DisplayLists based on the indices of the rendering operations that are desired. The RTree that the DisplayList produces will return indices within its list of the rectangles that are involved in the operation and a simple vector of "op indices" maintained by the RTree accumulator can be used to translate into an op index with a simple vector lookup.

Note that only the indices of the rendering ops are required.

The following ops will cull themselves if they are not needed:

  • all rendering ops (Draw...Op)
  • all saveLayers with their matching restores
  • all save operations with their matching restores
  • all transform ops
  • all clip ops

The following ops will not cull themselves and will always be executed. The tracking to prevent them from being executed would require a lot of overhead that is unlikely to save much time:

  • all set/clear attribute calls, most of which assign a simple value into a field in the dispatcher, some of which may cause a shared object to be created, though.

The culling is tested in its simplest form by the included unit test.

The performance of the overhead of this mechanism has not (yet) been measured.

There is a lot of bookkeeping cruft in this PR, mostly in the form of having to add a count_op() method to the DisplayListCalculator to reconstruct information that is known implicitly by the DisplayListBuilder. When the bounds and rtree calculation are merged into the Builder class via #34365, that cruft can be eliminated in favor of the Builder already knowing the indices of all of its ops.

The commits for this PR start with the same commits used for the previous "buffer offset" variant and then convert to using indices partway through because I implemented this variant first as a modification to those previous code changes.

@flar flar changed the title Display list index culling prototype based on op indices Display list culling prototype based on op indices Dec 15, 2022
@flar flar marked this pull request as draft December 15, 2022 01:09
@flar
Copy link
Contributor Author

flar commented Dec 22, 2022

Closing in favor of #38429

@flar flar closed this Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant