Index: include/gpu/GrXferProcessor.h |
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h |
index d39163c6df00989f9da0df5731cdb74875c8e6b9..1b4ec7fe620e83053a0ea69ac731ed8d285745c4 100644 |
--- a/include/gpu/GrXferProcessor.h |
+++ b/include/gpu/GrXferProcessor.h |
@@ -14,6 +14,7 @@ |
#include "GrTypes.h" |
#include "SkXfermode.h" |
+class GrPipelineBuilder; |
class GrShaderCaps; |
class GrGLSLCaps; |
class GrGLXferProcessor; |
@@ -228,10 +229,7 @@ public: |
bool fWriteColor; |
}; |
- void getBlendInfo(BlendInfo* blendInfo) const { |
- blendInfo->reset(); |
- this->onGetBlendInfo(blendInfo); |
- } |
+ void getBlendInfo(BlendInfo* blendInfo) const; |
bool willReadDstColor() const { return fWillReadDstColor; } |
@@ -252,15 +250,22 @@ public: |
} |
/** |
+ * If we are performing a dst read, returns whether this class will use mixed samples to |
+ * antialias the shader's final output. (If not doing a dst read, the subclass is responsible to |
+ * account for any mixed samples.) |
+ */ |
+ bool dstReadUsesMixedSamples() const { return fDstReadUsesMixedSamples; } |
+ |
+ /** |
* Returns whether or not the XP will look at coverage when doing its blending. |
*/ |
bool readsCoverage() const { return fReadsCoverage; } |
- /** |
+ /** |
* Returns whether or not this xferProcossor will set a secondary output to be used with dual |
* source blending. |
*/ |
- virtual bool hasSecondaryOutput() const { return false; } |
+ bool hasSecondaryOutput() const; |
/** Returns true if this and other processor conservatively draw identically. It can only return |
true when the two processor are of the same subclass (i.e. they return the same object from |
@@ -285,12 +290,15 @@ public: |
if (this->fDstTextureOffset != that.fDstTextureOffset) { |
return false; |
} |
+ if (this->fDstReadUsesMixedSamples != that.fDstReadUsesMixedSamples) { |
+ return false; |
+ } |
return this->onIsEqual(that); |
} |
protected: |
GrXferProcessor(); |
- GrXferProcessor(const DstTexture*, bool willReadDstColor); |
+ GrXferProcessor(const GrPipelineBuilder&, const DstTexture*, bool willReadDstColor); |
private: |
virtual OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, |
@@ -317,15 +325,23 @@ private: |
} |
/** |
- * Retrieves the hardware blend state required by this Xfer processor. The BlendInfo struct |
- * comes initialized to default values, so the Xfer processor only needs to set the state it |
- * needs. It may not even need to override this method at all. |
+ * If we are not performing a dst read, returns whether the subclass will set a secondary |
+ * output. If we are doing a dst read, the base class controls the secondary output and this |
+ * method will not be called. |
+ */ |
+ virtual bool onHasSecondaryOutput() const { return false; } |
+ |
+ /** |
+ * If we are not performing a dst read, retrieves the fixed-function blend state required by the |
+ * subclass. If we are doing a dst read, the base class controls the fixed-function blend state |
+ * and this method will not be called. The BlendInfo struct comes initialized to "no blending". |
*/ |
virtual void onGetBlendInfo(BlendInfo*) const {} |
virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
bool fWillReadDstColor; |
+ bool fDstReadUsesMixedSamples; |
bool fReadsCoverage; |
SkIPoint fDstTextureOffset; |
GrTextureAccess fDstTexture; |
@@ -351,7 +367,8 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); |
class GrXPFactory : public SkRefCnt { |
public: |
typedef GrXferProcessor::DstTexture DstTexture; |
- GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, |
+ GrXferProcessor* createXferProcessor(const GrPipelineBuilder&, |
Chris Dalton
2015/06/04 01:19:18
I thought it might be nicer to just send in a Pipe
|
+ const GrProcOptInfo& colorPOI, |
const GrProcOptInfo& coveragePOI, |
const DstTexture*, |
const GrCaps& caps) const; |
@@ -381,8 +398,8 @@ public: |
virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, |
InvariantBlendedColor*) const = 0; |
- bool willNeedDstTexture(const GrCaps& caps, const GrProcOptInfo& colorPOI, |
- const GrProcOptInfo& coveragePOI) const; |
+ bool willNeedDstTexture(const GrCaps& caps, const GrPipelineBuilder&, |
+ const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI) const; |
bool isEqual(const GrXPFactory& that) const { |
if (this->classID() != that.classID()) { |
@@ -410,6 +427,7 @@ protected: |
private: |
virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, |
+ const GrPipelineBuilder&, |
const GrProcOptInfo& colorPOI, |
const GrProcOptInfo& coveragePOI, |
const DstTexture*) const = 0; |
@@ -418,6 +436,7 @@ private: |
* shader. |
*/ |
virtual bool willReadDstColor(const GrCaps& caps, |
+ const GrPipelineBuilder&, |
const GrProcOptInfo& colorPOI, |
const GrProcOptInfo& coveragePOI) const = 0; |