ccpr: Add an MSAA atlas mode
Adds the option to use a multisampled (or mixed sampled) atlas, and
uses the sample mask and stencil buffer instead of coverage counts.
Bug: skia:
Change-Id: I9fb76d17895ae25208124f6c27e37977ac31b5eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227428
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ccpr/GrCCStroker.cpp b/src/gpu/ccpr/GrCCStroker.cpp
index a34a4c6..2829a2d 100644
--- a/src/gpu/ccpr/GrCCStroker.cpp
+++ b/src/gpu/ccpr/GrCCStroker.cpp
@@ -440,8 +440,9 @@
if (!GrCCStrokeGeometry::IsInternalJoinVerb(joinVerb)) {
// Normal joins are a triangle that connects the outer corners of two adjoining strokes.
- this->appendTriangleInstance().set(n1 * fCurrStrokeRadius, Sk2f(0, 0),
- n0 * fCurrStrokeRadius, offset);
+ this->appendTriangleInstance().set(
+ n1 * fCurrStrokeRadius, Sk2f(0, 0), n0 * fCurrStrokeRadius, offset,
+ TriangleInstance::Ordering::kXYTransposed);
if (Verb::kBevelJoin == joinVerb) {
return;
}
@@ -449,10 +450,18 @@
// Internal joins are coverage-counted, self-intersecting quadrilaterals that tie the
// four corners of two adjoining strokes together a like a shoelace. Coverage is
// negative on the inside half. We implement this geometry with a pair of triangles.
- this->appendTriangleInstance().set(-n0 * fCurrStrokeRadius, n0 * fCurrStrokeRadius,
- n1 * fCurrStrokeRadius, offset);
- this->appendTriangleInstance().set(-n0 * fCurrStrokeRadius, n1 * fCurrStrokeRadius,
- -n1 * fCurrStrokeRadius, offset);
+ this->appendTriangleInstance().set(
+ -n0 * fCurrStrokeRadius, n0 * fCurrStrokeRadius, n1 * fCurrStrokeRadius,
+ offset, TriangleInstance::Ordering::kXYTransposed);
+ if (Verb::kBevelJoin == joinVerb) {
+ return;
+ }
+ this->appendTriangleInstance().set(
+ -n0 * fCurrStrokeRadius, n1 * fCurrStrokeRadius, -n1 * fCurrStrokeRadius,
+ offset, TriangleInstance::Ordering::kXYTransposed);
+ if (Verb::kBevelJoin == joinVerb) {
+ return;
+ }
if (Verb::kInternalBevelJoin == joinVerb) {
return;
}
@@ -466,8 +475,9 @@
Sk2f c = (n0 + n1) * .5f + baseNorm * miterCapHeightOverWidth;
if (Verb::kMiterJoin == joinVerb) {
- this->appendTriangleInstance().set(n0 * fCurrStrokeRadius, c * fCurrStrokeRadius,
- n1 * fCurrStrokeRadius, offset);
+ this->appendTriangleInstance().set(
+ n0 * fCurrStrokeRadius, c * fCurrStrokeRadius, n1 * fCurrStrokeRadius, offset,
+ TriangleInstance::Ordering::kXYTransposed);
} else {
SkASSERT(Verb::kRoundJoin == joinVerb || Verb::kInternalRoundJoin == joinVerb);
this->appendConicInstance().setW(n0 * fCurrStrokeRadius, c * fCurrStrokeRadius,
@@ -491,7 +501,8 @@
this->appendLinearStrokeInstance().set(endPts, offset[0], offset[1], fCurrStrokeRadius);
} else {
SkASSERT(Verb::kRoundCap == capType);
- this->appendTriangleInstance().set(n, v, -n, offset);
+ this->appendTriangleInstance().set(
+ n, v, -n, offset, TriangleInstance::Ordering::kXYTransposed);
this->appendConicInstance().setW(n, n + v, v, offset, SK_ScalarRoot2Over2);
this->appendConicInstance().setW(v, v - n, -n, offset, SK_ScalarRoot2Over2);
}