| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 protected: | 46 protected: |
| 47 /** | 47 /** |
| 48 * Subclasses call this from their constructor to register vertex attributes
. Attributes | 48 * Subclasses call this from their constructor to register vertex attributes
. Attributes |
| 49 * will be padded to the nearest 4 bytes for performance reasons. | 49 * will be padded to the nearest 4 bytes for performance reasons. |
| 50 * TODO After deferred geometry, we should do all of this inline in Generate
Geometry alongside | 50 * TODO After deferred geometry, we should do all of this inline in Generate
Geometry alongside |
| 51 * the struct used to actually populate the attributes. This is all extreme
ly fragile, vertex | 51 * the struct used to actually populate the attributes. This is all extreme
ly fragile, vertex |
| 52 * attributes have to be added in the order they will appear in the struct w
hich maps memory. | 52 * attributes have to be added in the order they will appear in the struct w
hich maps memory. |
| 53 * The processor key should reflect the vertex attributes, or there lack the
reof in the | 53 * The processor key should reflect the vertex attributes, or there lack the
reof in the |
| 54 * GrGeometryProcessor. | 54 * GrGeometryProcessor. |
| 55 */ | 55 */ |
| 56 const Attribute& addVertexAttrib(const Attribute& attribute) { | 56 const Attribute& addVertexAttrib(const char* name, GrVertexAttribType type, |
| 57 fVertexStride += attribute.fOffset; | 57 GrSLPrecision precision = kDefault_GrSLPrec
ision) { |
| 58 fAttribs.push_back(attribute); | 58 fAttribs.emplace_back(name, type, precision); |
| 59 fVertexStride += fAttribs.back().fOffset; |
| 59 return fAttribs.back(); | 60 return fAttribs.back(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void setWillUseGeoShader() { fWillUseGeoShader = true; } | 63 void setWillUseGeoShader() { fWillUseGeoShader = true; } |
| 63 | 64 |
| 64 /** | 65 /** |
| 65 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov
ide them in one of | 66 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov
ide them in one of |
| 66 * three ways | 67 * three ways |
| 67 * 1) LocalCoordTransform * Position - in Shader | 68 * 1) LocalCoordTransform * Position - in Shader |
| 68 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader | 69 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader |
| (...skipping 21 matching lines...) Expand all Loading... |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 bool fWillUseGeoShader; | 93 bool fWillUseGeoShader; |
| 93 LocalCoordsType fLocalCoordsType; | 94 LocalCoordsType fLocalCoordsType; |
| 94 float fSampleShading; | 95 float fSampleShading; |
| 95 | 96 |
| 96 typedef GrPrimitiveProcessor INHERITED; | 97 typedef GrPrimitiveProcessor INHERITED; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 #endif | 100 #endif |
| OLD | NEW |