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

Unified Diff: include/gpu/GrEffect.h

Issue 13314002: Add support for reading the dst pixel value in an effect. Use in a new effect for the kDarken xfer … (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Revert whitespace/comment changes accidentally made in GrGLProgramDesc.cpp Created 7 years, 9 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 | « include/core/SkXfermode.h ('k') | include/gpu/GrTexture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrEffect.h
===================================================================
--- include/gpu/GrEffect.h (revision 8448)
+++ include/gpu/GrEffect.h (working copy)
@@ -138,6 +138,8 @@
/** Shortcut for textureAccess(index).texture(); */
GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); }
+ /** Will this effect read the destination pixel value? */
+ bool willReadDst() const { return fWillReadDst; }
int numVertexAttribs() const { return fVertexAttribTypes.count(); }
@@ -145,7 +147,6 @@
static const int kMaxVertexAttribs = 2;
-
/** Useful for effects that want to insert a texture matrix that is implied by the texture
dimensions */
static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) {
@@ -191,7 +192,7 @@
*/
void addVertexAttrib(GrSLType type);
- GrEffect() : fEffectRef(NULL) {};
+ GrEffect() : fWillReadDst(false), fEffectRef(NULL) {}
/** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for
an example factory function. */
@@ -234,6 +235,13 @@
return *static_cast<const T*>(&effectRef);
}
+ /**
+ * If the effect subclass will read the destination pixel value then it must call this function
+ * from its constructor. Otherwise, when its generated backend-specific effect class attempts
+ * to generate code that reads the destination pixel it will fail.
+ */
+ void setWillReadDst() { fWillReadDst = true; }
+
private:
bool isEqual(const GrEffect& other) const {
if (&this->getFactory() != &other.getFactory()) {
@@ -265,6 +273,7 @@
SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
SkSTArray<kMaxVertexAttribs, GrSLType, true> fVertexAttribTypes;
+ bool fWillReadDst;
GrEffectRef* fEffectRef;
typedef GrRefCnt INHERITED;
« no previous file with comments | « include/core/SkXfermode.h ('k') | include/gpu/GrTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698