Base class for PathAtlas implementations that rasterize coverage masks on the GPU using compute shaders.
When a new shape gets added, it gets tracked as input to a series of GPU compute passes. This data is recorded by recordDispatches()
into a DispatchGroup which can be added to a ComputeTask.
After a successful call to recordDispatches()
, the client is free to call reset()
and start adding new shapes for a future atlas render.
Definition at line 42 of file ComputePathAtlas.h.
bool skgpu::graphite::ComputePathAtlas::isSuitableForAtlasing |
( |
const Rect & |
transformedShapeBounds, |
|
|
const Rect & |
clipBounds |
|
) |
| const |
|
overrideprotectedvirtual |
Returns true if a path coverage mask with the given device-space bounds is sufficiently small to benefit from atlasing without causing too many atlas renders.
transformedShapeBounds
represents the device-space bounds of the coverage mask shape unrestricted by clip and viewport bounds.
clipBounds
represents the conservative bounding box of the union of the clip stack that should apply to the shape.
Reimplemented from skgpu::graphite::PathAtlas.
Definition at line 61 of file ComputePathAtlas.cpp.
62 {
63 Rect shapeBounds = transformedShapeBounds.makeRoundOut();
64 Rect maskBounds = shapeBounds.makeIntersect(clipBounds);
67
69 return false;
70 }
71
72
73
74
75 if (width *
height > kBboxAreaThreshold) {
76 return false;
77 }
78
79
81 if (std::fabs(unclippedSize.x()) > kCoordinateThreshold ||
82 std::fabs(unclippedSize.y()) > kCoordinateThreshold) {
83 return false;
84 }
85
86 return true;
87}