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 GrGeometryProcessor_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
9 #define GrGeometryProcessor_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 /** | 37 /** |
38 * Subclasses call this from their constructor to register vertex attributes
. Attributes | 38 * Subclasses call this from their constructor to register vertex attributes
. Attributes |
39 * will be padded to the nearest 4 bytes for performance reasons. | 39 * will be padded to the nearest 4 bytes for performance reasons. |
40 * TODO After deferred geometry, we should do all of this inline in Generate
Geometry alongside | 40 * TODO After deferred geometry, we should do all of this inline in Generate
Geometry alongside |
41 * the struct used to actually populate the attributes. This is all extreme
ly fragile, vertex | 41 * the struct used to actually populate the attributes. This is all extreme
ly fragile, vertex |
42 * attributes have to be added in the order they will appear in the struct w
hich maps memory. | 42 * attributes have to be added in the order they will appear in the struct w
hich maps memory. |
43 * The processor key should reflect the vertex attributes, or there lack the
reof in the | 43 * The processor key should reflect the vertex attributes, or there lack the
reof in the |
44 * GrGeometryProcessor. | 44 * GrGeometryProcessor. |
45 */ | 45 */ |
46 const Attribute& addVertexAttrib(const Attribute& attribute) { | 46 const Attribute& addVertexAttrib(const Attribute& attribute) { |
47 SkASSERT(fNumAttribs < kMaxVertexAttribs); | |
48 fVertexStride += attribute.fOffset; | 47 fVertexStride += attribute.fOffset; |
49 fAttribs[fNumAttribs] = attribute; | 48 fAttribs.push_back(attribute); |
50 return fAttribs[fNumAttribs++]; | 49 return fAttribs.back(); |
51 } | 50 } |
52 | 51 |
53 void setWillUseGeoShader() { fWillUseGeoShader = true; } | 52 void setWillUseGeoShader() { fWillUseGeoShader = true; } |
54 | 53 |
55 /** | 54 /** |
56 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov
ide them in one of | 55 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov
ide them in one of |
57 * three ways | 56 * three ways |
58 * 1) LocalCoordTransform * Position - in Shader | 57 * 1) LocalCoordTransform * Position - in Shader |
59 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader | 58 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader |
60 * 3) A transformation on the CPU uploaded via vertex attribute | 59 * 3) A transformation on the CPU uploaded via vertex attribute |
(...skipping 15 matching lines...) Expand all Loading... |
76 } | 75 } |
77 | 76 |
78 private: | 77 private: |
79 bool fWillUseGeoShader; | 78 bool fWillUseGeoShader; |
80 LocalCoordsType fLocalCoordsType; | 79 LocalCoordsType fLocalCoordsType; |
81 | 80 |
82 typedef GrPrimitiveProcessor INHERITED; | 81 typedef GrPrimitiveProcessor INHERITED; |
83 }; | 82 }; |
84 | 83 |
85 #endif | 84 #endif |
OLD | NEW |