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

Unified Diff: include/gpu/effects/GrPorterDuffXferProcessor.h

Issue 764643004: Create xfer processor backend. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferBlendSolo
Patch Set: Blend off ODS and only on XP Created 6 years 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 | « include/gpu/GrXferProcessor.h ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/effects/GrPorterDuffXferProcessor.h
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index 0ddfcdcd2a9594056bb12d469d5e85b5e0ca84bb..59499742d270a4bc7e878a270d2a50c4147a7e49 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -26,20 +26,53 @@ public:
virtual const char* name() const { return "Porter Duff"; }
- virtual void getGLProcessorKey(const GrGLCaps& caps,
- GrProcessorKeyBuilder* b) const SK_OVERRIDE;
-
- virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
-
- virtual GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- bool isCoverageDrawing,
- bool colorWriteDisabled,
- bool doesStencilWrite,
- GrColor* color,
- uint8_t* coverage) SK_OVERRIDE;
-
- virtual void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
+ void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
+
+ GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+ virtual bool hasSecondaryOutput() const SK_OVERRIDE;
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// @name Stage Output Types
+ ////
+
+ enum PrimaryOutputType {
+ // Modulate color and coverage, write result as the color output.
+ kModulate_PrimaryOutputType,
+ // Combines the coverage, dst, and color as coverage * color + (1 - coverage) * dst. This
+ // can only be set if fDstReadKey is non-zero.
+ kCombineWithDst_PrimaryOutputType,
+ };
+
+ enum SecondaryOutputType {
+ // There is no secondary output
+ kNone_SecondaryOutputType,
+ // Writes coverage as the secondary output. Only set if dual source blending is supported
+ // and primary output is kModulate.
+ kCoverage_SecondaryOutputType,
+ // Writes coverage * (1 - colorA) as the secondary output. Only set if dual source blending
+ // is supported and primary output is kModulate.
+ kCoverageISA_SecondaryOutputType,
+ // Writes coverage * (1 - colorRGBA) as the secondary output. Only set if dual source
+ // blending is supported and primary output is kModulate.
+ kCoverageISC_SecondaryOutputType,
+
+ kSecondaryOutputTypeCnt,
+ };
+
+ PrimaryOutputType primaryOutputType() const { return fPrimaryOutputType; }
+ SecondaryOutputType secondaryOutputType() const { return fSecondaryOutputType; }
+
+ GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool isCoverageDrawing,
+ bool colorWriteDisabled,
+ bool doesStencilWrite,
+ GrColor* color,
+ uint8_t* coverage,
+ const GrDrawTargetCaps& caps) SK_OVERRIDE;
+
+ void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
blendInfo->fSrcBlend = fSrcBlend;
blendInfo->fDstBlend = fDstBlend;
blendInfo->fBlendConstant = fBlendConstant;
@@ -48,21 +81,36 @@ public:
private:
GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrColor constant);
- virtual bool onIsEqual(const GrFragmentProcessor& fpBase) const SK_OVERRIDE {
- const GrPorterDuffXferProcessor& xp = fpBase.cast<GrPorterDuffXferProcessor>();
+ bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
+ const GrPorterDuffXferProcessor& xp = xpBase.cast<GrPorterDuffXferProcessor>();
if (fSrcBlend != xp.fSrcBlend ||
fDstBlend != xp.fDstBlend ||
- fBlendConstant != xp.fBlendConstant) {
+ fBlendConstant != xp.fBlendConstant ||
+ fPrimaryOutputType != xp.fPrimaryOutputType ||
+ fSecondaryOutputType != xp.fSecondaryOutputType) {
return false;
}
return true;
}
- virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
+ void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
+
+ GrXferProcessor::OptFlags internalGetOptimizations(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool isCoverageDrawing,
+ bool colorWriteDisabled,
+ bool doesStencilWrite,
+ GrColor* color,
+ uint8_t* coverage);
+
+ void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTargetCaps& caps,
+ bool hasSolidCoverage, bool readDst);
GrBlendCoeff fSrcBlend;
GrBlendCoeff fDstBlend;
GrColor fBlendConstant;
+ PrimaryOutputType fPrimaryOutputType;
+ SecondaryOutputType fSecondaryOutputType;
typedef GrXferProcessor INHERITED;
};
@@ -107,6 +155,8 @@ private:
return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff);
}
+ GR_DECLARE_XP_FACTORY_TEST;
+
GrBlendCoeff fSrcCoeff;
GrBlendCoeff fDstCoeff;
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698