gfx/skia/trunk/src/gpu/effects/GrVertexEffect.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/gpu/effects/GrVertexEffect.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/*
     1.5 + * Copyright 2013 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef GrVertexEffect_DEFINED
    1.12 +#define GrVertexEffect_DEFINED
    1.13 +
    1.14 +#include "GrEffect.h"
    1.15 +
    1.16 +/**
    1.17 + * If an effect needs specialized vertex shader code, then it must inherit from this class.
    1.18 + * Otherwise it won't be able to add vertex attribs, and it might be given a vertexless shader
    1.19 + * program in emitCode.
    1.20 + */
    1.21 +class GrVertexEffect : public GrEffect {
    1.22 +public:
    1.23 +    GrVertexEffect() { fHasVertexCode = true; }
    1.24 +
    1.25 +protected:
    1.26 +    /**
    1.27 +     * Subclasses call this from their constructor to register vertex attributes (at most
    1.28 +     * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are
    1.29 +     * immutable.
    1.30 +     */
    1.31 +    void addVertexAttrib(GrSLType type) {
    1.32 +        SkASSERT(fVertexAttribTypes.count() < kMaxVertexAttribs);
    1.33 +        fVertexAttribTypes.push_back(type);
    1.34 +    }
    1.35 +
    1.36 +private:
    1.37 +    typedef GrEffect INHERITED;
    1.38 +};
    1.39 +
    1.40 +#endif

mercurial