diff options
author | Brian Salomon <bsalomon@google.com> | 2017-06-14 13:00:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-14 17:50:47 +0000 |
commit | e225b565fcdebcc5d642bd026f57c4514438d4e6 (patch) | |
tree | 283de14008b077c331ee951535d3b6abfbd81067 /src/gpu | |
parent | dcd499caed823f23bc70c07df7804a6dc1306606 (diff) |
Force AAType to MSAA if the render target has MSAA and the API doesn't support disabling it.
Change-Id: I88c29b8117fa82c6f41166b9333537a06bb841cc
Reviewed-on: https://skia-review.googlesource.com/19818
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrClipStackClip.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 27 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.h | 2 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.cpp | 2 |
4 files changed, 31 insertions, 3 deletions
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 15f976716b..af5a7ba03b 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -120,7 +120,8 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context, canDrawArgs.fShape = &shape; canDrawArgs.fAAType = GrChooseAAType(GrBoolToAA(element->isAA()), renderTargetContext->fsaaType(), - GrAllowMixedSamples::kYes); + GrAllowMixedSamples::kYes, + *context->caps()); canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings; // the 'false' parameter disallows use of the SW path renderer diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index f118b90e56..21a47eec49 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -55,6 +55,33 @@ #define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->drawingManager()->wasAbandoned()) { return false; } #define RETURN_NULL_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return nullptr; } +////////////////////////////////////////////////////////////////////////////// + +GrAAType GrChooseAAType(GrAA aa, GrFSAAType fsaaType, GrAllowMixedSamples allowMixedSamples, + const GrCaps& caps) { + if (GrAA::kNo == aa) { + // On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect + // that. + if (fsaaType == GrFSAAType::kUnifiedMSAA && !caps.multisampleDisableSupport()) { + return GrAAType::kMSAA; + } + return GrAAType::kNone; + } + switch (fsaaType) { + case GrFSAAType::kNone: + return GrAAType::kCoverage; + case GrFSAAType::kUnifiedMSAA: + return GrAAType::kMSAA; + case GrFSAAType::kMixedSamples: + return GrAllowMixedSamples::kYes == allowMixedSamples ? GrAAType::kMixedSamples + : GrAAType::kCoverage; + } + SkFAIL("Unexpected fsaa type"); + return GrAAType::kNone; +} + +////////////////////////////////////////////////////////////////////////////// + class AutoCheckFlush { public: AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingManager) { diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h index bcc5323c79..59edee5ace 100644 --- a/src/gpu/GrRenderTargetContext.h +++ b/src/gpu/GrRenderTargetContext.h @@ -357,7 +357,7 @@ protected: private: inline GrAAType chooseAAType(GrAA aa, GrAllowMixedSamples allowMixedSamples) { - return GrChooseAAType(aa, this->fsaaType(), allowMixedSamples); + return GrChooseAAType(aa, this->fsaaType(), allowMixedSamples, *this->caps()); } friend class GrAtlasTextBlob; // for access to add[Mesh]DrawOp diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index 6108e7ae44..f53e5fe8ce 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -607,7 +607,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, // The run's "font" overrides the anti-aliasing of the passed in SkPaint! GrAAType aaType = GrChooseAAType(this->aa(), renderTargetContext->fsaaType(), - GrAllowMixedSamples::kYes); + GrAllowMixedSamples::kYes, *renderTargetContext->caps()); std::unique_ptr<GrDrawOp> op = GrDrawPathRangeOp::Make( viewMatrix, fTextRatio, fTextInverseRatio * x, fTextInverseRatio * y, |