diff options
author | 2017-01-20 19:06:29 +0000 | |
---|---|---|
committer | 2017-01-20 20:04:01 +0000 | |
commit | 5be6c95fa95a518ab109339df4695d6dda6e2419 (patch) | |
tree | 2ebd8ff44d7701764ece1e87d183009c07dfedb0 /include | |
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 'include')
-rw-r--r-- | include/gpu/GrXferProcessor.h | 27 | ||||
-rw-r--r-- | include/gpu/effects/GrCoverageSetOpXP.h | 4 | ||||
-rw-r--r-- | include/gpu/effects/GrPorterDuffXferProcessor.h | 2 |
3 files changed, 25 insertions, 8 deletions
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h index 17cd2c7bf3..353c682f96 100644 --- a/include/gpu/GrXferProcessor.h +++ b/include/gpu/GrXferProcessor.h @@ -307,6 +307,16 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); class GrXPFactory { public: typedef GrXferProcessor::DstTexture DstTexture; + + /** Describes known properties of a draw's color input to the GrXferProcessor. */ + enum class ColorType { kUnknown, kOpaqueConstant, kConstant, kOpaque }; + + /** + * Indicates whether a draw's coverage input to the GrXferProcessor is solid, single channel + * or LCD (four channel coverage). + */ + enum class CoverageType { kNone, kSingleChannel, kLCD }; + GrXferProcessor* createXferProcessor(const GrPipelineAnalysis&, bool hasMixedSamples, const DstTexture*, @@ -329,24 +339,33 @@ public: virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, InvariantBlendedColor*) const = 0; - bool willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis&) const; + bool willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis& analysis) const; protected: constexpr GrXPFactory() {} + static bool ColorTypeIsOpaque(ColorType type) { + return ColorType::kOpaqueConstant == type || ColorType::kOpaque == type; + } + + static bool ColorTypeIsConstant(ColorType type) { + return ColorType::kOpaqueConstant == type || ColorType::kConstant == type; + } + private: virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, const GrPipelineAnalysis&, bool hasMixedSamples, const DstTexture*) const = 0; - bool willReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const; + bool willReadDstColor(const GrCaps& caps, const GrPipelineAnalysis& analysis) const; /** * Returns true if the XP generated by this factory will explicitly read dst in the fragment - * shader. + * shader. This will not be called for draws that read from PLS since the dst color is always + * available in such draws. */ - virtual bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const = 0; + virtual bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const = 0; }; #if defined(__GNUC__) || defined(__clang) #pragma GCC diagnostic pop diff --git a/include/gpu/effects/GrCoverageSetOpXP.h b/include/gpu/effects/GrCoverageSetOpXP.h index ca71abc4e0..385cad865e 100644 --- a/include/gpu/effects/GrCoverageSetOpXP.h +++ b/include/gpu/effects/GrCoverageSetOpXP.h @@ -40,9 +40,7 @@ private: bool hasMixedSamples, const DstTexture*) const override; - bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override { - return false; - } + bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const override { return false; } GR_DECLARE_XP_FACTORY_TEST; diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h index ca14275926..028cac65c8 100644 --- a/include/gpu/effects/GrPorterDuffXferProcessor.h +++ b/include/gpu/effects/GrPorterDuffXferProcessor.h @@ -63,7 +63,7 @@ private: bool hasMixedSamples, const DstTexture*) const override; - bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override; + bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const override; GR_DECLARE_XP_FACTORY_TEST; static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, int* outSecondary); |