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

Unified Diff: include/gpu/GrXferProcessor.h

Issue 896163003: Revert "Move DstCopy on gpu into the GrXferProcessor." (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix revert Created 5 years, 10 months 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 | « gyp/gpu.gypi ('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 929eb6b5da298f4956bb71c2531477a14639c049..13e4d2633ff30045b816db20b999744953a20ee7 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -10,7 +10,6 @@
#include "GrColor.h"
#include "GrProcessor.h"
-#include "GrTexture.h"
#include "GrTypes.h"
#include "SkXfermode.h"
@@ -35,10 +34,11 @@ class GrProcOptInfo;
class GrXferProcessor : public GrProcessor {
public:
/**
- * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLProcessorKey(...) to get the
- * specific subclass's key.
- */
- void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const;
+ * 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
@@ -103,21 +103,9 @@ public:
virtual void getBlendInfo(BlendInfo* blendInfo) const = 0;
+ /** Will this prceossor read the destination pixel value? */
bool willReadDstColor() const { return fWillReadDstColor; }
- /**
- * Returns the texture to be used as the destination when reading the dst in the fragment
- * shader. If the returned texture is NULL then the XP is either not reading the dst or we have
- * extentions that support framebuffer fetching and thus don't need a copy of the dst texture.
- */
- const GrTexture* getDstCopyTexture() const { return fDstCopy.getTexture(); }
-
- /**
- * Returns the offset into the DstCopyTexture to use when reading it in the shader. This value
- * is only valid if getDstCopyTexture() != NULL.
- */
- const SkIPoint& dstCopyTextureOffset() const { return fDstCopyTextureOffset; }
-
/**
* Returns whether or not this xferProcossor will set a secondary output to be used with dual
* source blending.
@@ -135,43 +123,29 @@ public:
if (this->classID() != that.classID()) {
return false;
}
- if (this->fWillReadDstColor != that.fWillReadDstColor) {
- return false;
- }
- if (this->fDstCopy.getTexture() != that.fDstCopy.getTexture()) {
- return false;
- }
- if (this->fDstCopyTextureOffset != that.fDstCopyTextureOffset) {
- return false;
- }
return this->onIsEqual(that);
}
protected:
- GrXferProcessor();
- GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
+ GrXferProcessor() : fWillReadDstColor(false) {}
-private:
/**
- * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer
- * processor's GL backend implementation.
+ * If the prceossor subclass will read the destination pixel value then it must call this
+ * function from its constructor. Otherwise, when its generated backend-specific prceossor class
+ * attempts to generate code that reads the destination pixel it will fail.
*/
- virtual void onGetGLProcessorKey(const GrGLCaps& caps,
- GrProcessorKeyBuilder* b) const = 0;
+ void setWillReadDstColor() { fWillReadDstColor = true; }
+private:
virtual bool onIsEqual(const GrXferProcessor&) const = 0;
- bool fWillReadDstColor;
- SkIPoint fDstCopyTextureOffset;
- GrTextureAccess fDstCopy;
+ bool fWillReadDstColor;
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
@@ -185,10 +159,8 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags);
*/
class GrXPFactory : public SkRefCnt {
public:
- GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- const GrDeviceCoordTexture* dstCopy,
- const GrDrawTargetCaps& caps) const;
+ virtual GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI) const = 0;
/**
* This function returns true if the GrXferProcessor generated from this factory will be able to
@@ -230,7 +202,10 @@ public:
*/
virtual bool canTweakAlphaForCoverage() const = 0;
- bool willNeedDstCopy(const GrDrawTargetCaps& caps) const;
+ /**
+ * Returns true if the XP generated by this factory will read dst.
+ */
+ virtual bool willReadDst() const = 0;
bool isEqual(const GrXPFactory& that) const {
if (this->classID() != that.classID()) {
@@ -257,15 +232,6 @@ protected:
uint32_t fClassID;
private:
- virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
- const GrProcOptInfo& coveragePOI,
- const GrDeviceCoordTexture* dstCopy) const = 0;
- /**
- * Returns true if the XP generated by this factory will explicitly read dst in the fragment
- * shader.
- */
- virtual bool willReadDstColor() const = 0;
-
virtual bool onIsEqual(const GrXPFactory&) const = 0;
static uint32_t GenClassID() {
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/effects/GrPorterDuffXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698