| 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 |
| 11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
| 12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrClip.h" | 13 #include "GrClip.h" |
| 14 #include "GrGpuResourceRef.h" | 14 #include "GrGpuResourceRef.h" |
| 15 #include "GrStagedProcessor.h" | 15 #include "GrStagedProcessor.h" |
| 16 #include "GrProcOptInfo.h" | 16 #include "GrProcOptInfo.h" |
| 17 #include "GrProcessorDataManager.h" | 17 #include "GrProcessorDataManager.h" |
| 18 #include "GrRenderTarget.h" | 18 #include "GrRenderTarget.h" |
| 19 #include "GrStencil.h" | 19 #include "GrStencil.h" |
| 20 #include "GrXferProcessor.h" | 20 #include "GrXferProcessor.h" |
| 21 #include "SkMatrix.h" | 21 #include "SkMatrix.h" |
| 22 #include "effects/GrCoverageSetOpXP.h" | 22 #include "effects/GrCoverageSetOpXP.h" |
| 23 #include "effects/GrDisableColorXP.h" | 23 #include "effects/GrDisableColorXP.h" |
| 24 #include "effects/GrPorterDuffXferProcessor.h" | 24 #include "effects/GrPorterDuffXferProcessor.h" |
| 25 #include "effects/GrSimpleTextureEffect.h" | 25 #include "effects/GrSimpleTextureEffect.h" |
| 26 | 26 |
| 27 class GrBatch; | 27 class GrDrawBatch; |
| 28 class GrCaps; | 28 class GrCaps; |
| 29 class GrPaint; | 29 class GrPaint; |
| 30 class GrTexture; | 30 class GrTexture; |
| 31 | 31 |
| 32 class GrPipelineBuilder { | 32 class GrPipelineBuilder { |
| 33 public: | 33 public: |
| 34 GrPipelineBuilder(); | 34 GrPipelineBuilder(); |
| 35 | 35 |
| 36 GrPipelineBuilder(const GrPipelineBuilder& pipelineBuilder) { | 36 GrPipelineBuilder(const GrPipelineBuilder& pipelineBuilder) { |
| 37 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) | 37 SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 393 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
| 394 this->calcColorInvariantOutput(pp); | 394 this->calcColorInvariantOutput(pp); |
| 395 return fColorProcInfo; | 395 return fColorProcInfo; |
| 396 } | 396 } |
| 397 | 397 |
| 398 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | 398 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ |
| 399 this->calcCoverageInvariantOutput(pp); | 399 this->calcCoverageInvariantOutput(pp); |
| 400 return fCoverageProcInfo; | 400 return fCoverageProcInfo; |
| 401 } | 401 } |
| 402 | 402 |
| 403 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { | 403 const GrProcOptInfo& colorProcInfo(const GrDrawBatch* batch) const { |
| 404 this->calcColorInvariantOutput(batch); | 404 this->calcColorInvariantOutput(batch); |
| 405 return fColorProcInfo; | 405 return fColorProcInfo; |
| 406 } | 406 } |
| 407 | 407 |
| 408 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { | 408 const GrProcOptInfo& coverageProcInfo(const GrDrawBatch* batch) const { |
| 409 this->calcCoverageInvariantOutput(batch); | 409 this->calcCoverageInvariantOutput(batch); |
| 410 return fCoverageProcInfo; | 410 return fCoverageProcInfo; |
| 411 } | 411 } |
| 412 | 412 |
| 413 void setClip(const GrClip& clip) { fClip = clip; } | 413 void setClip(const GrClip& clip) { fClip = clip; } |
| 414 const GrClip& clip() const { return fClip; } | 414 const GrClip& clip() const { return fClip; } |
| 415 | 415 |
| 416 GrProcessorDataManager* getProcessorDataManager() { return fProcDataManager.
get(); } | 416 GrProcessorDataManager* getProcessorDataManager() { return fProcDataManager.
get(); } |
| 417 const GrProcessorDataManager* processorDataManager() const { return fProcDat
aManager.get(); } | 417 const GrProcessorDataManager* processorDataManager() const { return fProcDat
aManager.get(); } |
| 418 | 418 |
| 419 private: | 419 private: |
| 420 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the | 420 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the |
| 421 // results. | 421 // results. |
| 422 // | 422 // |
| 423 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a | 423 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a |
| 424 // specific color and coverage. May be calle
d multiple times | 424 // specific color and coverage. May be calle
d multiple times |
| 425 // GrOptDrawState constructor - never caches results | 425 // GrOptDrawState constructor - never caches results |
| 426 | 426 |
| 427 /** | 427 /** |
| 428 * Primproc variants of the calc functions | 428 * Primproc variants of the calc functions |
| 429 * TODO remove these when batch is everywhere | 429 * TODO remove these when batch is everywhere |
| 430 */ | 430 */ |
| 431 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 431 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
| 432 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 432 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
| 433 | 433 |
| 434 /** | 434 /** |
| 435 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data | 435 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
| 436 */ | 436 */ |
| 437 void calcColorInvariantOutput(const GrBatch*) const; | 437 void calcColorInvariantOutput(const GrDrawBatch*) const; |
| 438 void calcCoverageInvariantOutput(const GrBatch*) const; | 438 void calcCoverageInvariantOutput(const GrDrawBatch*) const; |
| 439 | 439 |
| 440 /** | 440 /** |
| 441 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 441 * If fColorProcInfoValid is false, function calculates the invariant output
for the color |
| 442 * processors and results are stored in fColorProcInfo. | 442 * processors and results are stored in fColorProcInfo. |
| 443 */ | 443 */ |
| 444 void calcColorInvariantOutput(GrColor) const; | 444 void calcColorInvariantOutput(GrColor) const; |
| 445 | 445 |
| 446 /** | 446 /** |
| 447 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | 447 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage |
| 448 * processors and results are stored in fCoverageProcInfo. | 448 * processors and results are stored in fCoverageProcInfo. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 469 mutable GrProcOptInfo fCoverageProcInfo; | 469 mutable GrProcOptInfo fCoverageProcInfo; |
| 470 mutable bool fColorProcInfoValid; | 470 mutable bool fColorProcInfoValid; |
| 471 mutable bool fCoverageProcInfoValid; | 471 mutable bool fCoverageProcInfoValid; |
| 472 mutable GrColor fColorCache; | 472 mutable GrColor fColorCache; |
| 473 mutable GrColor fCoverageCache; | 473 mutable GrColor fCoverageCache; |
| 474 | 474 |
| 475 friend class GrPipeline; | 475 friend class GrPipeline; |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 #endif | 478 #endif |
| OLD | NEW |