diff options
author | bsalomon <bsalomon@google.com> | 2016-03-23 10:40:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-23 10:40:53 -0700 |
commit | 7dbd45d2c7427d2c679d6507435d2f0220bf64ef (patch) | |
tree | ae53a6f2d968b65da8706e791617988e86af3118 /src/gpu/GrPrimitiveProcessor.h | |
parent | 1443c6920c4b7aa80811c30ed9cdc81395d5df4f (diff) |
Make max number of vertex attributes be checked dynamically
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1822343002
Review URL: https://codereview.chromium.org/1822343002
Diffstat (limited to 'src/gpu/GrPrimitiveProcessor.h')
-rw-r--r-- | src/gpu/GrPrimitiveProcessor.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h index e5c8517250..e8bb449888 100644 --- a/src/gpu/GrPrimitiveProcessor.h +++ b/src/gpu/GrPrimitiveProcessor.h @@ -151,12 +151,6 @@ public: // we put these calls on the base class to prevent having to cast virtual bool willUseGeoShader() const = 0; - /* - * This is a safeguard to prevent GrPrimitiveProcessor's from going beyond platform specific - * attribute limits. This number can almost certainly be raised if required. - */ - static const int kMaxVertexAttribs = 8; - struct Attribute { Attribute() : fName(nullptr) @@ -174,11 +168,8 @@ public: GrSLPrecision fPrecision; }; - int numAttribs() const { return fNumAttribs; } - const Attribute& getAttrib(int index) const { - SkASSERT(index < fNumAttribs); - return fAttribs[index]; - } + int numAttribs() const { return fAttribs.count(); } + const Attribute& getAttrib(int index) const { return fAttribs[index]; } // Returns the vertex stride of the GP. A common use case is to request geometry from a // drawtarget based off of the stride, and to populate this memory using an implicit array of @@ -227,12 +218,10 @@ public: virtual const char* getDestColorOverride() const { return nullptr; } protected: - GrPrimitiveProcessor() - : fNumAttribs(0) - , fVertexStride(0) {} + GrPrimitiveProcessor() : fVertexStride(0) {} - Attribute fAttribs[kMaxVertexAttribs]; - int fNumAttribs; + enum { kPreallocAttribCnt = 8 }; + SkSTArray<kPreallocAttribCnt, Attribute> fAttribs; size_t fVertexStride; private: |