| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 */ | 374 */ |
| 375 void setDrawFace(DrawFace face) { | 375 void setDrawFace(DrawFace face) { |
| 376 SkASSERT(kInvalid_DrawFace != face); | 376 SkASSERT(kInvalid_DrawFace != face); |
| 377 fDrawFace = face; | 377 fDrawFace = face; |
| 378 } | 378 } |
| 379 | 379 |
| 380 /// @} | 380 /// @} |
| 381 | 381 |
| 382 /////////////////////////////////////////////////////////////////////////// | 382 /////////////////////////////////////////////////////////////////////////// |
| 383 | 383 |
| 384 // TODO delete when we have Batch | |
| 385 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | |
| 386 this->calcColorInvariantOutput(pp); | |
| 387 return fColorProcInfo; | |
| 388 } | |
| 389 | |
| 390 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | |
| 391 this->calcCoverageInvariantOutput(pp); | |
| 392 return fCoverageProcInfo; | |
| 393 } | |
| 394 | |
| 395 const GrProcOptInfo& colorProcInfo(const GrDrawBatch* batch) const { | 384 const GrProcOptInfo& colorProcInfo(const GrDrawBatch* batch) const { |
| 396 this->calcColorInvariantOutput(batch); | 385 this->calcColorInvariantOutput(batch); |
| 397 return fColorProcInfo; | 386 return fColorProcInfo; |
| 398 } | 387 } |
| 399 | 388 |
| 400 const GrProcOptInfo& coverageProcInfo(const GrDrawBatch* batch) const { | 389 const GrProcOptInfo& coverageProcInfo(const GrDrawBatch* batch) const { |
| 401 this->calcCoverageInvariantOutput(batch); | 390 this->calcCoverageInvariantOutput(batch); |
| 402 return fCoverageProcInfo; | 391 return fCoverageProcInfo; |
| 403 } | 392 } |
| 404 | 393 |
| 405 void setClip(const GrClip& clip) { fClip = clip; } | 394 void setClip(const GrClip& clip) { fClip = clip; } |
| 406 const GrClip& clip() const { return fClip; } | 395 const GrClip& clip() const { return fClip; } |
| 407 | 396 |
| 408 GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager
; } | 397 GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager
; } |
| 409 const GrProcessorDataManager* processorDataManager() const { return &fProcDa
taManager; } | 398 const GrProcessorDataManager* processorDataManager() const { return &fProcDa
taManager; } |
| 410 | 399 |
| 411 private: | 400 private: |
| 412 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the | 401 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the |
| 413 // results. | 402 // results. |
| 414 // | 403 // |
| 415 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a | 404 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a |
| 416 // specific color and coverage. May be calle
d multiple times | 405 // specific color and coverage. May be calle
d multiple times |
| 417 // GrOptDrawState constructor - never caches results | 406 // GrOptDrawState constructor - never caches results |
| 418 | 407 |
| 419 /** | 408 /** |
| 420 * Primproc variants of the calc functions | |
| 421 * TODO remove these when batch is everywhere | |
| 422 */ | |
| 423 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | |
| 424 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | |
| 425 | |
| 426 /** | |
| 427 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data | 409 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
| 428 */ | 410 */ |
| 429 void calcColorInvariantOutput(const GrDrawBatch*) const; | 411 void calcColorInvariantOutput(const GrDrawBatch*) const; |
| 430 void calcCoverageInvariantOutput(const GrDrawBatch*) const; | 412 void calcCoverageInvariantOutput(const GrDrawBatch*) const; |
| 431 | 413 |
| 432 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 414 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
| 433 // This is used to assert that this condition holds. | 415 // This is used to assert that this condition holds. |
| 434 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) | 416 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) |
| 435 | 417 |
| 436 typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArra
y; | 418 typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArra
y; |
| 437 | 419 |
| 438 GrProcessorDataManager fProcDataManager; | 420 GrProcessorDataManager fProcDataManager; |
| 439 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 421 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 440 uint32_t fFlags; | 422 uint32_t fFlags; |
| 441 GrStencilSettings fStencilSettings; | 423 GrStencilSettings fStencilSettings; |
| 442 DrawFace fDrawFace; | 424 DrawFace fDrawFace; |
| 443 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 425 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 444 FragmentProcessorArray fColorFragmentProcessors; | 426 FragmentProcessorArray fColorFragmentProcessors; |
| 445 FragmentProcessorArray fCoverageFragmentProcessors; | 427 FragmentProcessorArray fCoverageFragmentProcessors; |
| 446 GrClip fClip; | 428 GrClip fClip; |
| 447 | 429 |
| 448 mutable GrProcOptInfo fColorProcInfo; | 430 mutable GrProcOptInfo fColorProcInfo; |
| 449 mutable GrProcOptInfo fCoverageProcInfo; | 431 mutable GrProcOptInfo fCoverageProcInfo; |
| 450 | 432 |
| 451 friend class GrPipeline; | 433 friend class GrPipeline; |
| 452 }; | 434 }; |
| 453 | 435 |
| 454 #endif | 436 #endif |
| OLD | NEW |