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

Unified Diff: include/gpu/GrEffect.h

Issue 23653059: Mark when effects and programs have vertex code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | « no previous file | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrEffect.h
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index e7590b6793495e6d9052c2284e4497269af85b6b..4dc294bfe8a1bbd49de162fe63b7dc1ba476f6f3 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -17,6 +17,7 @@
class GrBackendEffectFactory;
class GrContext;
class GrEffect;
+class GrVertexEffect;
class SkString;
/**
@@ -152,7 +153,14 @@ public:
/** Will this effect read the fragment position? */
bool willReadFragmentPosition() const { return fWillReadFragmentPosition; }
- int numVertexAttribs() const { return fVertexAttribTypes.count(); }
+ /** Will this effect emit custom vertex shader code?
+ (To set this value the effect must inherit from GrVertexEffect.) */
+ bool hasVertexCode() const { return fHasVertexCode; }
+
+ int numVertexAttribs() const {
+ SkASSERT(0 == fVertexAttribTypes.count() || fHasVertexCode);
+ return fVertexAttribTypes.count();
+ }
GrSLType vertexAttribType(int index) const { return fVertexAttribTypes[index]; }
@@ -204,14 +212,11 @@ protected:
*/
void addTextureAccess(const GrTextureAccess* textureAccess);
- /**
- * Subclasses call this from their constructor to register vertex attributes (at most
- * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are
- * immutable.
- */
- void addVertexAttrib(GrSLType type);
-
- GrEffect() : fWillReadDstColor(false), fWillReadFragmentPosition(false), fEffectRef(NULL) {}
+ GrEffect()
+ : fWillReadDstColor(false)
+ , fWillReadFragmentPosition(false)
+ , fHasVertexCode(false)
+ , fEffectRef(NULL) {}
/** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for
an example factory function. */
@@ -300,15 +305,17 @@ private:
void EffectRefDestroyed() { fEffectRef = NULL; }
- friend class GrEffectRef; // to call EffectRefDestroyed()
- friend class GrEffectStage; // to rewrap GrEffect in GrEffectRef when restoring an effect-stage
- // from deferred state, to call isEqual on naked GrEffects, and
- // to inc/dec deferred ref counts.
+ friend class GrEffectRef; // to call EffectRefDestroyed()
+ friend class GrEffectStage; // to rewrap GrEffect in GrEffectRef when restoring an effect-stage
+ // from deferred state, to call isEqual on naked GrEffects, and
+ // to inc/dec deferred ref counts.
+ friend class GrVertexEffect; // to set fHasVertexCode and build fVertexAttribTypes.
SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
SkSTArray<kMaxVertexAttribs, GrSLType, true> fVertexAttribTypes;
bool fWillReadDstColor;
bool fWillReadFragmentPosition;
+ bool fHasVertexCode;
GrEffectRef* fEffectRef;
typedef SkRefCnt INHERITED;
« no previous file with comments | « no previous file | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698