OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 * initial value (after construction or reset()) is 0xff. The constant | 208 * initial value (after construction or reset()) is 0xff. The constant |
209 * coverage is ignored when per-vertex coverage is provided. | 209 * coverage is ignored when per-vertex coverage is provided. |
210 */ | 210 */ |
211 void setCoverage(uint8_t coverage) { | 211 void setCoverage(uint8_t coverage) { |
212 if (coverage != fCoverage) { | 212 if (coverage != fCoverage) { |
213 fCoverage = coverage; | 213 fCoverage = coverage; |
214 fCoverageProcInfoValid = false; | 214 fCoverageProcInfoValid = false; |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
| 218 /** |
| 219 * Determines whether the output of the coverage stages will be single compo
nent. |
| 220 */ |
| 221 bool coverageWillBeSingleComponent() const; |
| 222 |
218 /// @} | 223 /// @} |
219 | 224 |
220 /** | 225 /** |
221 * The geometry processor is the sole element of the skia pipeline which can
use the vertex, | 226 * The geometry processor is the sole element of the skia pipeline which can
use the vertex, |
222 * geometry, and tesselation shaders. The GP may also compute a coverage in
its fragment shader | 227 * geometry, and tesselation shaders. The GP may also compute a coverage in
its fragment shader |
223 * but is never put in the color processing pipeline. | 228 * but is never put in the color processing pipeline. |
224 */ | 229 */ |
225 | 230 |
226 const GrGeometryProcessor* setGeometryProcessor(const GrGeometryProcessor* g
eometryProcessor) { | 231 const GrGeometryProcessor* setGeometryProcessor(const GrGeometryProcessor* g
eometryProcessor) { |
227 SkASSERT(geometryProcessor); | 232 SkASSERT(geometryProcessor); |
(...skipping 25 matching lines...) Expand all Loading... |
253 | 258 |
254 int numColorStages() const { return fColorStages.count(); } | 259 int numColorStages() const { return fColorStages.count(); } |
255 int numCoverageStages() const { return fCoverageStages.count(); } | 260 int numCoverageStages() const { return fCoverageStages.count(); } |
256 int numFragmentStages() const { return this->numColorStages() + this->numCov
erageStages(); } | 261 int numFragmentStages() const { return this->numColorStages() + this->numCov
erageStages(); } |
257 int numTotalStages() const { | 262 int numTotalStages() const { |
258 return this->numFragmentStages() + (this->hasGeometryProcessor() ? 1 :
0); | 263 return this->numFragmentStages() + (this->hasGeometryProcessor() ? 1 :
0); |
259 } | 264 } |
260 | 265 |
261 bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get()
); } | 266 bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get()
); } |
262 const GrGeometryProcessor* getGeometryProcessor() const { return fGeometryPr
ocessor.get(); } | 267 const GrGeometryProcessor* getGeometryProcessor() const { return fGeometryPr
ocessor.get(); } |
| 268 |
| 269 const GrXPFactory* getXPFactory() const { return fXPFactory.get(); } |
| 270 |
263 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id
x]; } | 271 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id
x]; } |
264 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta
ges[idx]; } | 272 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta
ges[idx]; } |
265 | 273 |
266 /** | 274 /** |
267 * Checks whether any of the effects will read the dst pixel color. | 275 * Checks whether any of the effects will read the dst pixel color. |
268 */ | 276 */ |
269 bool willEffectReadDstColor() const; | 277 bool willEffectReadDstColor() const; |
270 | 278 |
271 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe
ct) { | 279 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe
ct) { |
272 SkASSERT(effect); | 280 SkASSERT(effect); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 uint32_t fFlagBits; | 784 uint32_t fFlagBits; |
777 const GrVertexAttrib* fVAPtr; | 785 const GrVertexAttrib* fVAPtr; |
778 int fVACount; | 786 int fVACount; |
779 size_t fVAStride; | 787 size_t fVAStride; |
780 GrStencilSettings fStencilSettings; | 788 GrStencilSettings fStencilSettings; |
781 uint8_t fCoverage; | 789 uint8_t fCoverage; |
782 DrawFace fDrawFace; | 790 DrawFace fDrawFace; |
783 GrBlendCoeff fSrcBlend; | 791 GrBlendCoeff fSrcBlend; |
784 GrBlendCoeff fDstBlend; | 792 GrBlendCoeff fDstBlend; |
785 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 793 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
| 794 SkAutoTUnref<const GrXPFactory> fXPFactory; |
786 FragmentStageArray fColorStages; | 795 FragmentStageArray fColorStages; |
787 FragmentStageArray fCoverageStages; | 796 FragmentStageArray fCoverageStages; |
788 uint32_t fHints; | 797 uint32_t fHints; |
789 | 798 |
790 // This is simply a different representation of info in fVertexAttribs and t
hus does | 799 // This is simply a different representation of info in fVertexAttribs and t
hus does |
791 // not need to be compared in op==. | 800 // not need to be compared in op==. |
792 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt
]; | 801 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt
]; |
793 | 802 |
794 mutable GrProcOptInfo fColorProcInfo; | 803 mutable GrProcOptInfo fColorProcInfo; |
795 mutable GrProcOptInfo fCoverageProcInfo; | 804 mutable GrProcOptInfo fCoverageProcInfo; |
796 mutable bool fColorProcInfoValid; | 805 mutable bool fColorProcInfoValid; |
797 mutable bool fCoverageProcInfoValid; | 806 mutable bool fCoverageProcInfoValid; |
798 | 807 |
799 friend class GrOptDrawState; | 808 friend class GrOptDrawState; |
800 }; | 809 }; |
801 | 810 |
802 #endif | 811 #endif |
OLD | NEW |