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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 return fXPFactory.get(); | 98 return fXPFactory.get(); |
99 } | 99 } |
100 | 100 |
101 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id
x]; } | 101 const GrFragmentStage& getColorStage(int idx) const { return fColorStages[id
x]; } |
102 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta
ges[idx]; } | 102 const GrFragmentStage& getCoverageStage(int idx) const { return fCoverageSta
ges[idx]; } |
103 | 103 |
104 /** | 104 /** |
105 * Checks whether the xp will need a copy of the destination to correctly bl
end. | 105 * Checks whether the xp will need a copy of the destination to correctly bl
end. |
106 */ | 106 */ |
107 bool willXPNeedDstCopy(const GrDrawTargetCaps& caps) const; | 107 bool willXPNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& co
lorPOI, |
| 108 const GrProcOptInfo& coveragePOI) const; |
108 | 109 |
109 /** | 110 /** |
110 * The xfer processor factory. | 111 * The xfer processor factory. |
111 */ | 112 */ |
112 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 113 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
113 fXPFactory.reset(SkRef(xpFactory)); | 114 fXPFactory.reset(SkRef(xpFactory)); |
114 return xpFactory; | 115 return xpFactory; |
115 } | 116 } |
116 | 117 |
117 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 118 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 SkASSERT(kInvalid_DrawFace != face); | 383 SkASSERT(kInvalid_DrawFace != face); |
383 fDrawFace = face; | 384 fDrawFace = face; |
384 } | 385 } |
385 | 386 |
386 /// @} | 387 /// @} |
387 | 388 |
388 /////////////////////////////////////////////////////////////////////////// | 389 /////////////////////////////////////////////////////////////////////////// |
389 | 390 |
390 GrPipelineBuilder& operator= (const GrPipelineBuilder& that); | 391 GrPipelineBuilder& operator= (const GrPipelineBuilder& that); |
391 | 392 |
392 private: | |
393 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the | |
394 // results. | |
395 // | |
396 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a | |
397 // specific color and coverage. May be calle
d multiple times | |
398 // willBlendWithDst() - only called by Nvpr, does not cache results | |
399 // GrOptDrawState constructor - never caches results | |
400 | |
401 // TODO delete when we have Batch | 393 // TODO delete when we have Batch |
402 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 394 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
403 this->calcColorInvariantOutput(pp); | 395 this->calcColorInvariantOutput(pp); |
404 return fColorProcInfo; | 396 return fColorProcInfo; |
405 } | 397 } |
406 | 398 |
407 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | 399 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ |
408 this->calcCoverageInvariantOutput(pp); | 400 this->calcCoverageInvariantOutput(pp); |
409 return fCoverageProcInfo; | 401 return fCoverageProcInfo; |
410 } | 402 } |
411 | 403 |
412 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { | 404 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { |
413 this->calcColorInvariantOutput(batch); | 405 this->calcColorInvariantOutput(batch); |
414 return fColorProcInfo; | 406 return fColorProcInfo; |
415 } | 407 } |
416 | 408 |
417 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { | 409 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { |
418 this->calcCoverageInvariantOutput(batch); | 410 this->calcCoverageInvariantOutput(batch); |
419 return fCoverageProcInfo; | 411 return fCoverageProcInfo; |
420 } | 412 } |
| 413 private: |
| 414 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the |
| 415 // results. |
| 416 // |
| 417 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a |
| 418 // specific color and coverage. May be calle
d multiple times |
| 419 // willBlendWithDst() - only called by Nvpr, does not cache results |
| 420 // GrOptDrawState constructor - never caches results |
421 | 421 |
422 /** | 422 /** |
423 * Primproc variants of the calc functions | 423 * Primproc variants of the calc functions |
424 * TODO remove these when batch is everywhere | 424 * TODO remove these when batch is everywhere |
425 */ | 425 */ |
426 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 426 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
427 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 427 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
428 | 428 |
429 /** | 429 /** |
430 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data | 430 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 mutable GrProcOptInfo fCoverageProcInfo; | 462 mutable GrProcOptInfo fCoverageProcInfo; |
463 mutable bool fColorProcInfoValid; | 463 mutable bool fColorProcInfoValid; |
464 mutable bool fCoverageProcInfoValid; | 464 mutable bool fCoverageProcInfoValid; |
465 mutable GrColor fColorCache; | 465 mutable GrColor fColorCache; |
466 mutable GrColor fCoverageCache; | 466 mutable GrColor fCoverageCache; |
467 | 467 |
468 friend class GrPipeline; | 468 friend class GrPipeline; |
469 }; | 469 }; |
470 | 470 |
471 #endif | 471 #endif |
OLD | NEW |