Index: src/gpu/GrClipMaskManager.cpp |
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp |
index 076871ca05b25a001f66ef790de30c87d1d7dfd9..c3934f3d5e532b8084b29a10d0f8850b21f82e11 100644 |
--- a/src/gpu/GrClipMaskManager.cpp |
+++ b/src/gpu/GrClipMaskManager.cpp |
@@ -368,8 +368,22 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder, |
} |
} |
- // If MSAA is enabled we can do everything in the stencil buffer. |
- if (0 == rt->numStencilSamples() && requiresAA) { |
+ SkASSERT(!pipelineBuilder.isHWAntialias() || rt->isStencilBufferMultisampled()); |
+ |
+ bool hasHWAntialias = pipelineBuilder.isHWAntialias(); |
+ |
+ if (rt->isStencilBufferMultisampled() && !hasHWAntialias) { |
+ if (!this->caps()->multisampleDisableSupport()) { |
+ hasHWAntialias = true; // This will be on regardless, it's impossible to turn it off. |
+ } else if (this->caps()->programmableSampleLocationsSupport()) { |
+ // Enable HW antialias, but leave the draw non-antialiased by co-centering the samples. |
+ out->fIsCoCenteredMultisampledDraw = true; |
+ hasHWAntialias = true; |
+ } |
+ } |
+ |
+ // If we have HW antialias, or don't need AA, we can do everything in the stencil buffer. |
+ if (!hasHWAntialias && requiresAA) { |
SkAutoTUnref<GrTexture> result; |
// The top-left of the mask corresponds to the top-left corner of the bounds. |