OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrPipelineBuilder_DEFINED | 8 #ifndef GrPipelineBuilder_DEFINED |
9 #define GrPipelineBuilder_DEFINED | 9 #define GrPipelineBuilder_DEFINED |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 int numCoverageFragmentStages() const { return fCoverageStages.count(); } | 62 int numCoverageFragmentStages() const { return fCoverageStages.count(); } |
63 int numFragmentStages() const { return this->numColorFragmentStages() + | 63 int numFragmentStages() const { return this->numColorFragmentStages() + |
64 this->numCoverageFragmentStages()
; } | 64 this->numCoverageFragmentStages()
; } |
65 | 65 |
66 const GrFragmentStage& getColorFragmentStage(int idx) const { return fColorS
tages[idx]; } | 66 const GrFragmentStage& getColorFragmentStage(int idx) const { return fColorS
tages[idx]; } |
67 const GrFragmentStage& getCoverageFragmentStage(int idx) const { return fCov
erageStages[idx]; } | 67 const GrFragmentStage& getCoverageFragmentStage(int idx) const { return fCov
erageStages[idx]; } |
68 | 68 |
69 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe
ct) { | 69 const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effe
ct) { |
70 SkASSERT(effect); | 70 SkASSERT(effect); |
71 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (effect)); | 71 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (effect)); |
72 fColorProcInfoValid = false; | |
73 return effect; | 72 return effect; |
74 } | 73 } |
75 | 74 |
76 const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* e
ffect) { | 75 const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* e
ffect) { |
77 SkASSERT(effect); | 76 SkASSERT(effect); |
78 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect)); | 77 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect)); |
79 fCoverageProcInfoValid = false; | |
80 return effect; | 78 return effect; |
81 } | 79 } |
82 | 80 |
83 /** | 81 /** |
84 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin
ates. | 82 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin
ates. |
85 */ | 83 */ |
86 void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { | 84 void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { |
87 this->addColorProcessor(GrSimpleTextureEffect::Create(fProcDataManager,
texture, | 85 this->addColorProcessor(GrSimpleTextureEffect::Create(fProcDataManager,
texture, |
88 matrix))->unref(); | 86 matrix))->unref(); |
89 } | 87 } |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 */ | 428 */ |
431 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 429 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
432 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 430 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
433 | 431 |
434 /** | 432 /** |
435 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data | 433 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
436 */ | 434 */ |
437 void calcColorInvariantOutput(const GrDrawBatch*) const; | 435 void calcColorInvariantOutput(const GrDrawBatch*) const; |
438 void calcCoverageInvariantOutput(const GrDrawBatch*) const; | 436 void calcCoverageInvariantOutput(const GrDrawBatch*) const; |
439 | 437 |
440 /** | |
441 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | |
442 * processors and results are stored in fColorProcInfo. | |
443 */ | |
444 void calcColorInvariantOutput(GrColor) const; | |
445 | |
446 /** | |
447 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | |
448 * processors and results are stored in fCoverageProcInfo. | |
449 */ | |
450 void calcCoverageInvariantOutput(GrColor) const; | |
451 | |
452 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 438 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
453 // This is used to assert that this condition holds. | 439 // This is used to assert that this condition holds. |
454 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) | 440 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) |
455 | 441 |
456 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; | 442 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; |
457 | 443 |
458 SkAutoTUnref<GrProcessorDataManager> fProcDataManager; | 444 SkAutoTUnref<GrProcessorDataManager> fProcDataManager; |
459 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 445 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
460 uint32_t fFlags; | 446 uint32_t fFlags; |
461 GrStencilSettings fStencilSettings; | 447 GrStencilSettings fStencilSettings; |
462 DrawFace fDrawFace; | 448 DrawFace fDrawFace; |
463 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 449 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
464 FragmentStageArray fColorStages; | 450 FragmentStageArray fColorStages; |
465 FragmentStageArray fCoverageStages; | 451 FragmentStageArray fCoverageStages; |
466 GrClip fClip; | 452 GrClip fClip; |
467 | 453 |
468 mutable GrProcOptInfo fColorProcInfo; | 454 mutable GrProcOptInfo fColorProcInfo; |
469 mutable GrProcOptInfo fCoverageProcInfo; | 455 mutable GrProcOptInfo fCoverageProcInfo; |
470 mutable bool fColorProcInfoValid; | |
471 mutable bool fCoverageProcInfoValid; | |
472 mutable GrColor fColorCache; | |
473 mutable GrColor fCoverageCache; | |
474 | 456 |
475 friend class GrPipeline; | 457 friend class GrPipeline; |
476 }; | 458 }; |
477 | 459 |
478 #endif | 460 #endif |
OLD | NEW |