Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1107)

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 1431593006: Fix mixed samples stencil clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698