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

Unified Diff: include/gpu/GrXferProcessor.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/GrProcessorUnitTest.h ('k') | include/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrXferProcessor.h
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index b7d0bdd9fa9ef7717471a3857b9e788e95793378..696359b8b3fb351438c3d0b816e802a23422725f 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,9 +31,21 @@ 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:
/**
+ * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer
+ * processor's GL backend implementation.
+ */
+ 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.
*/
enum OptFlags {
@@ -74,7 +89,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 +103,27 @@ public:
/** Will this prceossor read the destination pixel value? */
bool willReadDstColor() const { return fWillReadDstColor; }
+ /**
+ * Returns whether or not this xferProcossor will set a secondary output to be used with dual
+ * source blending.
+ */
+ virtual bool hasSecondaryOutput() const { return false; }
+
+ /** 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 +135,7 @@ protected:
void setWillReadDstColor() { fWillReadDstColor = true; }
private:
+ virtual bool onIsEqual(const GrXferProcessor&) const = 0;
bool fWillReadDstColor;
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | include/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698