patch. The overall goal is to make clip chain handling
not depend on screen rectangle generation. This
will make it much easier to implement local space
picture rasterization for perspective elements. In
addition to that, we unify how user / hierarchical and
primitive clip chain nodes are handled.
Clip chain instances are built on demand now, as
required by primitives. Right now, none of the
clip chain information is cached between primitives.
In general, now that the calculations are done in
local space, they are much faster - however we can
easily start to cache the common clip-chain state
(per raster coordinate system) if it ever shows up
in a profile. Additionally, since we only build
clip chains on demand, and clip chains for non-
visible primitives are not built, which is a
decent saving on many pages.
Remove ClipNode altogether. Instead, during flattening
we map directly from a ClipId to a ClipChainId
as appropriate. Clip chains are now created during
flattening and the links remain constant. It's only
during construction of a clip chain instance that we
include and exclude parts of the specified clip
chain. This unifies how we handle user defined clip
chains and legacy hierarchical clip chains. At the
same time, unify how the optional primitive specific
complex clip is handled with clip chains. Now, if
a primitive has a complex clip, it's added as a
normal clip chain node, and linked to the parent
clip chain that this primitive would otherwise
be attached to.
Primitive runs now only depend on the spatial node.
This results in far fewer primitive run breaks.
ClipWorkItems are now stored as a single contiguous
array in the ClipStore. To achieve this they are
stored as an index buffer, and a clip node range
is simply an (index, count). These are a lot
cheaper to pass to clip masks, and also require
fewer heap allocations.
Port hit testing to use the same clip chain data
structures that the main clip code uses, now that
the hierarchical and user defined clip chains are
handled in a uniform way.
Remove the need for Arc in clip chain code, since
clip chains are now stored in a contiguous index
buffer style structure.