michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrVertexEffect_DEFINED michael@0: #define GrVertexEffect_DEFINED michael@0: michael@0: #include "GrEffect.h" michael@0: michael@0: /** michael@0: * If an effect needs specialized vertex shader code, then it must inherit from this class. michael@0: * Otherwise it won't be able to add vertex attribs, and it might be given a vertexless shader michael@0: * program in emitCode. michael@0: */ michael@0: class GrVertexEffect : public GrEffect { michael@0: public: michael@0: GrVertexEffect() { fHasVertexCode = true; } michael@0: michael@0: protected: michael@0: /** michael@0: * Subclasses call this from their constructor to register vertex attributes (at most michael@0: * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are michael@0: * immutable. michael@0: */ michael@0: void addVertexAttrib(GrSLType type) { michael@0: SkASSERT(fVertexAttribTypes.count() < kMaxVertexAttribs); michael@0: fVertexAttribTypes.push_back(type); michael@0: } michael@0: michael@0: private: michael@0: typedef GrEffect INHERITED; michael@0: }; michael@0: michael@0: #endif