gpu: cache path data for compute

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-01-02 20:13:06 +01:00
parent 23f710910f
commit bb9252f9d4
3 changed files with 22 additions and 12 deletions
+5 -6
View File
@@ -824,15 +824,14 @@ func (d *drawOps) collect(ctx backend.Device, cache *resourceCache, root *op.Ops
for _, p := range d.pathOps {
if v, exists := d.pathCache.get(p.pathKey); !exists || v.data.data == nil {
data := buildPath(ctx, p.pathVerts)
var pathVerts []byte
var computePath encoder
if d.retainPathData {
pathVerts = make([]byte, len(p.pathVerts))
copy(pathVerts, p.pathVerts)
computePath = encodePath(p.pathVerts)
}
d.pathCache.put(p.pathKey, opCacheValue{
data: data,
bounds: p.bounds,
cpuData: pathVerts,
data: data,
bounds: p.bounds,
computePath: computePath,
})
}
p.pathVerts = nil