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

Unified Diff: src/gpu/GrPrimitiveProcessor.h

Issue 1822343002: Make max number of vertex attributes be checked dynamically (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 9 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 | « src/gpu/GrGpu.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPrimitiveProcessor.h
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index e5c8517250cec51790a50b85a087f75a6db483b5..e8bb449888460c33dce1cbeb07f5cf7e570eeb15 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:
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698