[graphite] Track ssbo index in SortKey to simplify DrawPassUniformWriter

Instead of storing the sparse/random UniformDataCache::Index, this
switches the SortKey to store the dense ssbo index that the
UniformDataWriter has determined for the DrawPass. The impact on sorting
is unchanged, but means that the ssbo index is available immediately
when iterating the SortKeys and writing vertices, which saves some
map lookups.

Additionally, this updates the logic inside UniformDataWriter to track
the data in a helper CpuOrGpu struct that starts out storing the
UniformDataCache::Index and SkUniformBlock*, then overwrites it to the
BindBufferInfo pointing to its location on the GPU. This simplifies the
writing logic since we can allocate one large buffer range for each
batch. The ssbo vs. ubo logic is encapsulated entirely in what
buffer binding we remember and how often we bind it (even when using
ubo's, the dense "ssbo" index is useful in the SortKey for avoding
map lookups).

Lastly, this switches from using batch keys to just tracking the
uniform data grouped by pipeline index. This can lead to replicated
data if paints or render steps have the same exact uniform data but
are referenced from a new combination of paint/step. However, the
pipeline index is dense, so we can organize the nested maps for tracking
ssbo index in an outer array instead of a map of maps.

Change-Id: I350eb9b09cf24fbdfbcac5e6cd819982f4105cdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/574338
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
1 file changed