| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrPrimitiveProcessor_DEFINED | 8 #ifndef GrPrimitiveProcessor_DEFINED |
| 9 #define GrPrimitiveProcessor_DEFINED | 9 #define GrPrimitiveProcessor_DEFINED |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 * This is a safeguard to prevent GrPrimitiveProcessor's from going beyond p
latform specific | 119 * This is a safeguard to prevent GrPrimitiveProcessor's from going beyond p
latform specific |
| 120 * attribute limits. This number can almost certainly be raised if required. | 120 * attribute limits. This number can almost certainly be raised if required. |
| 121 */ | 121 */ |
| 122 static const int kMaxVertexAttribs = 6; | 122 static const int kMaxVertexAttribs = 6; |
| 123 | 123 |
| 124 struct Attribute { | 124 struct Attribute { |
| 125 Attribute() | 125 Attribute() |
| 126 : fName(NULL) | 126 : fName(NULL) |
| 127 , fType(kFloat_GrVertexAttribType) | 127 , fType(kFloat_GrVertexAttribType) |
| 128 , fOffset(0) {} | 128 , fOffset(0) {} |
| 129 Attribute(const char* name, GrVertexAttribType type) | 129 Attribute(const char* name, GrVertexAttribType type, |
| 130 GrSLPrecision precision = kDefault_GrSLPrecision) |
| 130 : fName(name) | 131 : fName(name) |
| 131 , fType(type) | 132 , fType(type) |
| 132 , fOffset(SkAlign4(GrVertexAttribTypeSize(type))) {} | 133 , fOffset(SkAlign4(GrVertexAttribTypeSize(type))) |
| 134 , fPrecision(precision) {} |
| 133 const char* fName; | 135 const char* fName; |
| 134 GrVertexAttribType fType; | 136 GrVertexAttribType fType; |
| 135 size_t fOffset; | 137 size_t fOffset; |
| 138 GrSLPrecision fPrecision; |
| 136 }; | 139 }; |
| 137 | 140 |
| 138 int numAttribs() const { return fNumAttribs; } | 141 int numAttribs() const { return fNumAttribs; } |
| 139 const Attribute& getAttrib(int index) const { | 142 const Attribute& getAttrib(int index) const { |
| 140 SkASSERT(index < fNumAttribs); | 143 SkASSERT(index < fNumAttribs); |
| 141 return fAttribs[index]; | 144 return fAttribs[index]; |
| 142 } | 145 } |
| 143 | 146 |
| 144 // Returns the vertex stride of the GP. A common use case is to request geo
metry from a | 147 // Returns the vertex stride of the GP. A common use case is to request geo
metry from a |
| 145 // drawtarget based off of the stride, and to populate this memory using an
implicit array of | 148 // drawtarget based off of the stride, and to populate this memory using an
implicit array of |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 183 |
| 181 private: | 184 private: |
| 182 virtual bool hasExplicitLocalCoords() const = 0; | 185 virtual bool hasExplicitLocalCoords() const = 0; |
| 183 | 186 |
| 184 bool fIsPathRendering; | 187 bool fIsPathRendering; |
| 185 | 188 |
| 186 typedef GrProcessor INHERITED; | 189 typedef GrProcessor INHERITED; |
| 187 }; | 190 }; |
| 188 | 191 |
| 189 #endif | 192 #endif |
| OLD | NEW |