DescriptionMozart: Improve internal scene graph representation.
This patch changes the internal scene graph representation into an
immutable data structure which allows for multiple versions to be
maintained simultaneously as well as for the node structure to be
preserved during snapshot operations.
Previously the node structure was traversed once during snapshot
with the intent that all relevant information would be recorded
info an immutable |RenderFrame| object for rasterization and for
hit testing. However it proved prohibitively expensive to copy
the necessary node structure information into the |RenderFrame|
for hit testing. So this change does away with all of that.
The compositor now keeps three levels of structural information
to be generated and traversed as required.
1. |SceneDef| which holds a table of immutable |NodeDef| objects
describing the currently presented state of the scene graph
and pending updates which have yet to be applied.
2. |SceneContent| which is generated from a |SceneDef| when the
scene graph is presented. It consists of an immutable index
of |NodeDef| objects for a particular version of the scene
graph as it existed at the time of presentation. This index
contains sufficient linkage information to ensure that the
scene does not contain any internal cross-node cycles and
that all references resources and nodes are reachable.
3. |Snapshot| which is generated from a collection of |SceneContent|
objects when the frame is snapshotted. When producing the
snapshot, all scene references are resolved and combinator
rules are evaluated to produce a final description of a single
frame of graphical content to be rasterized. The |Snapshot|
can also be traversed later for hit testing purposes since
it retains a record of the disposition of each node (whether
they were blocked).
Altogether, these new representations resolve numerous issues with
the old model such as how we can retain multiple versions of a
scene for as long as required or how we can traverse particular
versions or snapshots of the scene graph to execute queries such
as hit testing.
There are still many optimizations we could apply to the structure
but it's already looking much better overall and there is
significantly less wasted effort during snapshotting when blocked
nodes are discovered.
This also puts us in a nice position to start dealing with
synchronization issues such as applications which publish scenes
referencing textures which have yet to be produced: while walking
the tree we can make a decision of whether to wait or to fallback
on previously published content which may be already be ready with
per-scene granularity. (To do later.)
(Hit testing itself will be implemented in a later patch.)
BUG=
R=abarth@google.com
Committed: https://chromium.googlesource.com/external/mojo/+/33eb773f692f9df5cf08d3bdc1e9e4569dfd1c67
Patch Set 1 #Patch Set 2 : #
Total comments: 8
Patch Set 3 : avoid unnecessary hashtable lookups #Dependent Patchsets: Messages
Total messages: 6 (2 generated)
|