Chromium Code Reviews| Index: include/gpu/GrEffect.h |
| =================================================================== |
| --- include/gpu/GrEffect.h (revision 8019) |
| +++ include/gpu/GrEffect.h (working copy) |
| @@ -14,6 +14,7 @@ |
| #include "GrRefCnt.h" |
| #include "GrTexture.h" |
| #include "GrTextureAccess.h" |
| +#include "GrTypesPriv.h" |
| class GrBackendEffectFactory; |
| class GrContext; |
| @@ -136,6 +137,12 @@ |
| /** Shortcut for textureAccess(index).texture(); */ |
| GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); } |
| + |
| + int numVertexAttribs() const { return fVertexAttribTypes.count(); } |
| + |
| + GrSLType vertexAttribType(int index) const { return fVertexAttribTypes[index]; } |
| + |
| + |
| /** Useful for effects that want to insert a texture matrix that is implied by the texture |
| dimensions */ |
| static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { |
| @@ -168,12 +175,18 @@ |
| protected: |
| /** |
| - * Subclasses call this from their constructor to register GrTextureAcceses. The effect subclass |
| - * manages the lifetime of the accesses (this function only stores a pointer). This must only be |
| - * called from the constructor because GrEffects are supposed to be immutable. |
| + * Subclasses call this from their constructor to register GrTextureAccesses. The effect |
| + * subclass manages the lifetime of the accesses (this function only stores a pointer). This |
| + * must only be called from the constructor because GrEffects are immutable. |
| */ |
| void addTextureAccess(const GrTextureAccess* textureAccess); |
| + /** |
| + * Subclasses call this from their constructor to register vertex attributes. This must only be |
|
bsalomon
2013/03/08 14:31:58
Should we document the current limitation here? (a
jvanverth1
2013/03/08 17:39:55
Done. Also created a constant GrEffect::kMaxVertex
|
| + * called from the constructor because GrEffects are immutable. |
| + */ |
| + void addVertexAttrib(GrSLType type); |
| + |
| GrEffect() : fEffectRef(NULL) {}; |
| /** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for |
| @@ -247,6 +260,7 @@ |
| // to inc/dec deferred ref counts. |
| SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses; |
| + SkSTArray<2, GrSLType, true> fVertexAttribTypes; |
| GrEffectRef* fEffectRef; |
| typedef GrRefCnt INHERITED; |