Index: include/gpu/GrXferProcessor.h |
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h |
index b7d0bdd9fa9ef7717471a3857b9e788e95793378..7dc09d62f53aa976e6c049f836ade11cb1aaac69 100644 |
--- a/include/gpu/GrXferProcessor.h |
+++ b/include/gpu/GrXferProcessor.h |
@@ -9,10 +9,13 @@ |
#define GrXferProcessor_DEFINED |
#include "GrColor.h" |
-#include "GrFragmentProcessor.h" |
+#include "GrProcessor.h" |
#include "GrTypes.h" |
#include "SkXfermode.h" |
+class GrDrawTargetCaps; |
+class GrGLCaps; |
+class GrGLXferProcessor; |
class GrProcOptInfo; |
/** |
@@ -28,8 +31,17 @@ class GrProcOptInfo; |
* A GrXferProcessor is never installed directly into our draw state, but instead is created from a |
* GrXPFactory once we have finalized the state of our draw. |
*/ |
-class GrXferProcessor : public GrFragmentProcessor { |
+class GrXferProcessor : public GrProcessor { |
public: |
+ /** Implemented using GLFragmentProcessor::GenKey as described in this class's comment. */ |
bsalomon
2014/12/08 19:58:59
Is this comment correct?
egdaniel
2014/12/09 21:10:46
Nope no longer, updated.
|
+ virtual void getGLProcessorKey(const GrGLCaps& caps, |
+ GrProcessorKeyBuilder* b) const = 0; |
+ |
+ /** Returns a new instance of the appropriate *GL* implementation class |
+ for the given GrXferProcessor; caller is responsible for deleting |
+ the object. */ |
+ virtual GrGLXferProcessor* createGLInstance() const = 0; |
+ |
/** |
* Optimizations for blending / coverage that an OptDrawState should apply to itself. |
*/ |
@@ -74,7 +86,8 @@ public: |
bool colorWriteDisabled, |
bool doesStencilWrite, |
GrColor* color, |
- uint8_t* coverage) = 0; |
+ uint8_t* coverage, |
+ const GrDrawTargetCaps& caps) = 0; |
struct BlendInfo { |
GrBlendCoeff fSrcBlend; |
@@ -87,6 +100,23 @@ public: |
/** Will this prceossor read the destination pixel value? */ |
bool willReadDstColor() const { return fWillReadDstColor; } |
+ virtual bool hasSecondaryOutput() const { return false; } |
bsalomon
2014/12/08 19:58:58
Document?
egdaniel
2014/12/09 21:10:46
Done.
|
+ |
+ /** 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 |
+ from getFactory()). |
+ |
+ A return value of true from isEqual() should not be used to test whether the processor would |
+ generate the same shader code. To test for identical code generation use getGLProcessorKey*/ |
+ |
+ bool isEqual(const GrXferProcessor& that) const { |
+ if (this->classID() != that.classID()) { |
+ return false; |
+ } |
+ return this->onIsEqual(that); |
+ } |
+ |
+ |
protected: |
GrXferProcessor() : fWillReadDstColor(false) {} |
@@ -98,6 +128,7 @@ protected: |
void setWillReadDstColor() { fWillReadDstColor = true; } |
private: |
+ virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
bool fWillReadDstColor; |