Remove all instances of incorrect coverage with DMSAA
Here we pivot and handle DMSAA differently depending on platform:
1) Desktop GL and EXT_multisample_compatibility: Here it's easy to use
all our existing coverage ops because we can just call
glDisable(GL_MULTISAMPLE). So we only trigger MSAA for paths and
use the coverage ops for everything else with MSAA disabled.
2) EXT_multisampled_render_to_to_texture (86% adoption on Android):
The assumption here is that MSAA is almost free. So we just allow
MSAA to be triggered often and don't worry about it.
Devices that neither support #1 nor #2 just don't get DMSAA for now.
Bug: skia:11396
Change-Id: I53ad840216ea6d88ae69eece6f7a062f9e82dad7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421019
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 7dd213b..2240135 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -297,10 +297,10 @@
}
inline GrAAType GrSurfaceDrawContext::chooseAAType(GrAA aa) {
- if (fCanUseDynamicMSAA) {
- // Trigger dmsaa by default if the render target has it. Coverage ops that know how to
- // handle both single and multisample targets without popping will do so without calling
- // chooseAAType.
+ if (fCanUseDynamicMSAA && !this->caps()->multisampleDisableSupport()) {
+ // Trigger dmsaa by default if we have it and we can't disable multisample. The few coverage
+ // ops we have that know how to handle both single and multisample targets without popping
+ // will do so without calling chooseAAType.
return GrAAType::kMSAA;
}
if (GrAA::kNo == aa) {
@@ -730,7 +730,7 @@
!this->caps()->reducedShaderMode()) {
// Only use the StrokeRectOp for non-empty rectangles. Empty rectangles will be processed by
// GrStyledShape to handle stroke caps and dashing properly.
- GrAAType aaType = (fCanUseDynamicMSAA) ? GrAAType::kCoverage : this->chooseAAType(aa);
+ GrAAType aaType = this->chooseAAType(aa);
GrOp::Owner op = GrStrokeRectOp::Make(
fContext, std::move(paint), aaType, viewMatrix, rect, stroke);
// op may be null if the stroke is not supported or if using coverage aa and the view matrix
@@ -1070,7 +1070,7 @@
op = GrFillRRectOp::Make(fContext, std::move(paint), viewMatrix, rrect, rrect.rect(),
GrAA(aaType != GrAAType::kNone));
}
- if (!op && (GrAAType::kCoverage == aaType || fCanUseDynamicMSAA)) {
+ if (!op && GrAAType::kCoverage == aaType) {
assert_alive(paint);
op = GrOvalOpFactory::MakeRRectOp(
fContext, std::move(paint), viewMatrix, rrect, stroke, this->caps()->shaderCaps());
@@ -1383,7 +1383,7 @@
op = GrFillRRectOp::Make(fContext, std::move(paint), viewMatrix, SkRRect::MakeOval(oval),
oval, GrAA(aaType != GrAAType::kNone));
}
- if (!op && (GrAAType::kCoverage == aaType || fCanUseDynamicMSAA)) {
+ if (!op && GrAAType::kCoverage == aaType) {
assert_alive(paint);
op = GrOvalOpFactory::MakeOvalOp(fContext, std::move(paint), viewMatrix, oval, style,
this->caps()->shaderCaps());
@@ -1416,7 +1416,7 @@
AutoCheckFlush acf(this->drawingManager());
GrAAType aaType = this->chooseAAType(aa);
- if (GrAAType::kCoverage == aaType || fCanUseDynamicMSAA) {
+ if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = this->caps()->shaderCaps();
GrOp::Owner op = GrOvalOpFactory::MakeArcOp(fContext,
std::move(paint),