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 * In an ideal world, two GrGeometryProcessors with the same class id and te
xture accesses | 38 * In an ideal world, two GrGeometryProcessors with the same class id and te
xture accesses |
39 * would ALWAYS be able to batch together. If two GrGeometryProcesosrs are
the same then we | 39 * would ALWAYS be able to batch together. If two GrGeometryProcesosrs are
the same then we |
40 * will only keep one of them. The remaining GrGeometryProcessor then updat
es its | 40 * will only keep one of them. The remaining GrGeometryProcessor then updat
es its |
41 * GrBatchTracker to incorporate the draw information from the GrGeometryPro
cessor we discard. | 41 * GrBatchTracker to incorporate the draw information from the GrGeometryPro
cessor we discard. |
42 * Any bundles associated with the discarded GrGeometryProcessor will be att
ached to the | 42 * Any bundles associated with the discarded GrGeometryProcessor will be att
ached to the |
43 * remaining GrGeometryProcessor. | 43 * remaining GrGeometryProcessor. |
44 */ | 44 */ |
45 bool canMakeEqual(const GrBatchTracker& mine, | 45 bool canMakeEqual(const GrBatchTracker& mine, |
46 const GrPrimitiveProcessor& that, | 46 const GrPrimitiveProcessor& that, |
47 const GrBatchTracker& theirs) const SK_OVERRIDE { | 47 const GrBatchTracker& theirs) const override { |
48 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(t
hat)) { | 48 if (this->classID() != that.classID() || !this->hasSameTextureAccesses(t
hat)) { |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 // TODO let the GPs decide this | 52 // TODO let the GPs decide this |
53 if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) { | 53 if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) { |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 // TODO remove the hint | 57 // TODO remove the hint |
(...skipping 11 matching lines...) Expand all Loading... |
69 return this->onCanMakeEqual(mine, other, theirs); | 69 return this->onCanMakeEqual(mine, other, theirs); |
70 } | 70 } |
71 | 71 |
72 // TODO we can remove color from the GrGeometryProcessor base class once we
have bundles of | 72 // TODO we can remove color from the GrGeometryProcessor base class once we
have bundles of |
73 // primitive data | 73 // primitive data |
74 GrColor color() const { return fColor; } | 74 GrColor color() const { return fColor; } |
75 | 75 |
76 // TODO this is a total hack until the gp can do deferred geometry | 76 // TODO this is a total hack until the gp can do deferred geometry |
77 bool hasVertexColor() const { return fHasVertexColor; } | 77 bool hasVertexColor() const { return fHasVertexColor; } |
78 | 78 |
79 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE; | 79 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; |
80 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID
E; | 80 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; |
81 | 81 |
82 protected: | 82 protected: |
83 /* | 83 /* |
84 * An optional simple helper function to determine by what means the GrGeome
tryProcessor should | 84 * An optional simple helper function to determine by what means the GrGeome
tryProcessor should |
85 * use to provide color. If we are given an override color(ie the given ove
rridecolor is NOT | 85 * use to provide color. If we are given an override color(ie the given ove
rridecolor is NOT |
86 * GrColor_ILLEGAL) then we must always emit that color(currently overrides
are only supported | 86 * GrColor_ILLEGAL) then we must always emit that color(currently overrides
are only supported |
87 * via uniform, but with deferred Geometry we could use attributes). Otherw
ise, if our color is | 87 * via uniform, but with deferred Geometry we could use attributes). Otherw
ise, if our color is |
88 * ignored then we should not emit a color. Lastly, if we don't have vertex
colors then we must | 88 * ignored then we should not emit a color. Lastly, if we don't have vertex
colors then we must |
89 * emit a color via uniform | 89 * emit a color via uniform |
90 * TODO this function changes quite a bit with deferred geometry. There the
GrGeometryProcessor | 90 * TODO this function changes quite a bit with deferred geometry. There the
GrGeometryProcessor |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const = 0; | 135 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const = 0; |
136 | 136 |
137 private: | 137 private: |
138 virtual bool onCanMakeEqual(const GrBatchTracker& mine, | 138 virtual bool onCanMakeEqual(const GrBatchTracker& mine, |
139 const GrGeometryProcessor& that, | 139 const GrGeometryProcessor& that, |
140 const GrBatchTracker& theirs) const = 0; | 140 const GrBatchTracker& theirs) const = 0; |
141 | 141 |
142 // TODO delete this when we have more advanced equality testing via bundles
and the BT | 142 // TODO delete this when we have more advanced equality testing via bundles
and the BT |
143 virtual bool onIsEqual(const GrGeometryProcessor&) const = 0; | 143 virtual bool onIsEqual(const GrGeometryProcessor&) const = 0; |
144 | 144 |
145 bool hasExplicitLocalCoords() const SK_OVERRIDE { return fHasLocalCoords; } | 145 bool hasExplicitLocalCoords() const override { return fHasLocalCoords; } |
146 | 146 |
147 GrColor fColor; | 147 GrColor fColor; |
148 bool fOpaqueVertexColors; | 148 bool fOpaqueVertexColors; |
149 bool fWillUseGeoShader; | 149 bool fWillUseGeoShader; |
150 bool fHasVertexColor; | 150 bool fHasVertexColor; |
151 bool fHasLocalCoords; | 151 bool fHasLocalCoords; |
152 | 152 |
153 typedef GrPrimitiveProcessor INHERITED; | 153 typedef GrPrimitiveProcessor INHERITED; |
154 }; | 154 }; |
155 | 155 |
156 #endif | 156 #endif |
OLD | NEW |