diff options
author | Brian Salomon <bsalomon@google.com> | 2017-01-20 19:06:29 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-20 20:04:01 +0000 |
commit | 5be6c95fa95a518ab109339df4695d6dda6e2419 (patch) | |
tree | 2ebd8ff44d7701764ece1e87d183009c07dfedb0 /src/gpu/GrXferProcessor.cpp | |
parent | aaedae7acb609ac9c914ca435ed845f0139916c0 (diff) |
Revert "Revert "Make it possible to query GrXPFactory for dst texture without GrPipelineAnalysis.""
This reverts commit 3329cceab5feca230df1caee16be045249228dc1.
Reason for revert: Bot failures are unrelated to the original change.
Change-Id: I21b5927dc4384a25930bdefe16e57bcc9276ffa4
Reviewed-on: https://skia-review.googlesource.com/7347
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrXferProcessor.cpp')
-rw-r--r-- | src/gpu/GrXferProcessor.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp index 7de0d77afd..d88259d48f 100644 --- a/src/gpu/GrXferProcessor.cpp +++ b/src/gpu/GrXferProcessor.cpp @@ -180,6 +180,40 @@ SkString GrXferProcessor::BlendInfo::dump() const { /////////////////////////////////////////////////////////////////////////////// +using ColorType = GrXPFactory::ColorType; +using CoverageType = GrXPFactory::CoverageType; + +ColorType analysis_color_type(const GrPipelineAnalysis& analysis) { + if (analysis.fColorPOI.validFlags() == kRGBA_GrColorComponentFlags) { + return GrColorIsOpaque(analysis.fColorPOI.color()) ? ColorType::kOpaqueConstant + : ColorType::kConstant; + } + if ((analysis.fColorPOI.validFlags() & kA_GrColorComponentFlag) && + GrColorIsOpaque(analysis.fColorPOI.color())) { + return ColorType::kOpaque; + } + return ColorType::kUnknown; +} + +CoverageType analysis_coverage_type(const GrPipelineAnalysis& analysis) { + if (analysis.fCoveragePOI.isSolidWhite()) { + return CoverageType::kNone; + } + if (analysis.fCoveragePOI.isLCDCoverage()) { + return CoverageType::kLCD; + } + return CoverageType::kSingleChannel; +} + +bool GrXPFactory::willReadDstColor(const GrCaps& caps, const GrPipelineAnalysis& analysis) const { + if (analysis.fUsesPLSDstRead) { + return true; + } + ColorType colorType = analysis_color_type(analysis); + CoverageType coverageType = analysis_coverage_type(analysis); + return this->willReadDstColor(caps, colorType, coverageType); +} + GrXferProcessor* GrXPFactory::createXferProcessor(const GrPipelineAnalysis& analysis, bool hasMixedSamples, const DstTexture* dstTexture, @@ -200,9 +234,6 @@ GrXferProcessor* GrXPFactory::createXferProcessor(const GrPipelineAnalysis& anal } bool GrXPFactory::willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis& analysis) const { - return (this->willReadDstColor(caps, analysis) && !caps.shaderCaps()->dstReadInShaderSupport()); -} - -bool GrXPFactory::willReadDstColor(const GrCaps& caps, const GrPipelineAnalysis& analysis) const { - return analysis.fUsesPLSDstRead || this->onWillReadDstColor(caps, analysis); + return !analysis.fUsesPLSDstRead && !caps.shaderCaps()->dstReadInShaderSupport() && + this->willReadDstColor(caps, analysis); } |