diff options
Diffstat (limited to 'src/gpu/GrXferProcessor.h')
-rw-r--r-- | src/gpu/GrXferProcessor.h | 74 |
1 files changed, 20 insertions, 54 deletions
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h index bdf6f7d50c..54630af750 100644 --- a/src/gpu/GrXferProcessor.h +++ b/src/gpu/GrXferProcessor.h @@ -108,32 +108,6 @@ public: virtual GrGLSLXferProcessor* createGLSLInstance() const = 0; /** - * Optimizations for blending / coverage that an OptDrawState should apply to itself. - */ - enum OptFlags { - /** - * GrXferProcessor will ignore color, thus no need to provide - */ - kIgnoreColor_OptFlag = 0x1, - /** - * Can tweak alpha for coverage. - */ - kCanTweakAlphaForCoverage_OptFlag = 0x2, - }; - - static const OptFlags kNone_OptFlags = (OptFlags)0; - - GR_DECL_BITFIELD_OPS_FRIENDS(OptFlags); - - /** - * Determines which optimizations (as described by the ptFlags above) can be performed by - * the draw with this xfer processor. If this function is called, the xfer processor may change - * its state to reflected the given blend optimizations. Callers are required to honor the - * returned OptFlags. - */ - OptFlags getOptimizations(const FragmentProcessorAnalysis&) const; - - /** * Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType * is updated to contain the type of barrier needed. */ @@ -224,8 +198,6 @@ protected: private: void notifyRefCntIsZero() const final {} - virtual OptFlags onGetOptimizations(const FragmentProcessorAnalysis&) const = 0; - /** * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer * processor's GL backend implementation. @@ -265,10 +237,6 @@ private: typedef GrFragmentProcessor INHERITED; }; -GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); - -/////////////////////////////////////////////////////////////////////////////// - /** * We install a GrXPFactory (XPF) early on in the pipeline before all the final draw information is * known (e.g. whether there is fractional pixel coverage, will coverage be 1 or 4 channel, is the @@ -305,22 +273,20 @@ public: const DstTexture*, const GrCaps& caps) const; - /** - * This will return true if the xfer processor needs the dst color in the shader and the way - * that the color will be made available to the xfer processor is by sampling a texture. - */ - static bool WillNeedDstTexture(const GrXPFactory*, - const GrCaps&, - const FragmentProcessorAnalysis&); + enum class AnalysisProperties : unsigned { + kNone = 0x0, + kReadsDstInShader = 0x1, + kRequiresDstTexture = 0x2, + kCompatibleWithAlphaAsCoverage = 0x4, + kIgnoresInputColor = 0x8, + kCanCombineOverlappedStencilAndCover = 0x10 + }; + GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(AnalysisProperties); - static bool CompatibleWithCoverageAsAlpha(const GrXPFactory*, bool colorIsOpaque); - - /** - * This indicates whether the the xfer processor will produce the same bleneded color result - * if a series of overlapping stencil and cover operations are replaced by a series of stencil - * operations and a single cover. A uniform src color is assumed. - **/ - static bool CanCombineOverlappedStencilAndCover(const GrXPFactory*, bool colorIsOpaque); + static AnalysisProperties GetAnalysisProperties(const GrXPFactory*, + const GrPipelineAnalysisColor&, + const GrPipelineAnalysisCoverage&, + const GrCaps&); protected: constexpr GrXPFactory() {} @@ -332,17 +298,17 @@ private: const DstTexture*) const = 0; /** - * Returns true if the XP generated by this factory will explicitly read dst in the fragment - * shader. + * Subclass analysis implementation. This should not return kNeedsDstInTexture as that will be + * inferred by the base class based on kReadsDstInShader and the caps. */ - virtual bool willReadDstInShader(const GrCaps&, const FragmentProcessorAnalysis&) const = 0; - - virtual bool compatibleWithCoverageAsAlpha(bool colorIsOpaque) const = 0; - virtual bool canCombineOverlappedStencilAndCover(bool colorIsOpaque) const { return false; } + virtual AnalysisProperties analysisProperties(const GrPipelineAnalysisColor&, + const GrPipelineAnalysisCoverage&, + const GrCaps&) const = 0; }; #if defined(__GNUC__) || defined(__clang) #pragma GCC diagnostic pop #endif -#endif +GR_MAKE_BITFIELD_CLASS_OPS(GrXPFactory::AnalysisProperties); +#endif |