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 | 11 #include "GrBatch.h" |
12 #include "GrBlend.h" | 12 #include "GrBlend.h" |
13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
14 #include "GrGeometryProcessor.h" | 14 #include "GrGeometryProcessor.h" |
15 #include "GrGpuResourceRef.h" | 15 #include "GrGpuResourceRef.h" |
16 #include "GrFragmentStage.h" | 16 #include "GrFragmentStage.h" |
17 #include "GrProcOptInfo.h" | 17 #include "GrProcOptInfo.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" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 fDrawFace = face; | 384 fDrawFace = face; |
385 } | 385 } |
386 | 386 |
387 /// @} | 387 /// @} |
388 | 388 |
389 /////////////////////////////////////////////////////////////////////////// | 389 /////////////////////////////////////////////////////////////////////////// |
390 | 390 |
391 GrPipelineBuilder& operator= (const GrPipelineBuilder& that); | 391 GrPipelineBuilder& operator= (const GrPipelineBuilder& that); |
392 | 392 |
393 private: | 393 private: |
| 394 // Calculating invariant color / coverage information is expensive, so we pa
rtially cache the |
| 395 // results. |
| 396 // |
| 397 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result
s but only for a |
| 398 // specific color and coverage. May be calle
d multiple times |
| 399 // willBlendWithDst() - only called by Nvpr, does not cache results |
| 400 // GrOptDrawState constructor - never caches results |
| 401 |
| 402 // TODO delete when we have Batch |
394 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 403 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
395 this->calcColorInvariantOutput(pp); | 404 this->calcColorInvariantOutput(pp); |
396 return fColorProcInfo; | 405 return fColorProcInfo; |
397 } | 406 } |
398 | 407 |
399 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | 408 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ |
400 this->calcCoverageInvariantOutput(pp); | 409 this->calcCoverageInvariantOutput(pp); |
401 return fCoverageProcInfo; | 410 return fCoverageProcInfo; |
402 } | 411 } |
403 | 412 |
| 413 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { |
| 414 this->calcColorInvariantOutput(batch); |
| 415 return fColorProcInfo; |
| 416 } |
| 417 |
| 418 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { |
| 419 this->calcCoverageInvariantOutput(batch); |
| 420 return fCoverageProcInfo; |
| 421 } |
| 422 |
404 /** | 423 /** |
405 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 424 * Primproc variants of the calc functions |
406 * stages and results are stored in fColorProcInfo. | 425 * TODO remove these when batch is everywhere |
407 */ | 426 */ |
408 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 427 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
409 | |
410 /** | |
411 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | |
412 * stages and results are stored in fCoverageProcInfo. | |
413 */ | |
414 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 428 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
415 | 429 |
416 /** | 430 /** |
| 431 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
| 432 */ |
| 433 void calcColorInvariantOutput(const GrBatch*) const; |
| 434 void calcCoverageInvariantOutput(const GrBatch*) const; |
| 435 |
| 436 /** |
417 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 437 * If fColorProcInfoValid is false, function calculates the invariant output
for the color |
418 * stages and results are stored in fColorProcInfo. | 438 * stages and results are stored in fColorProcInfo. |
419 */ | 439 */ |
420 void calcColorInvariantOutput(GrColor) const; | 440 void calcColorInvariantOutput(GrColor) const; |
421 | 441 |
422 /** | 442 /** |
423 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | 443 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage |
424 * stages and results are stored in fCoverageProcInfo. | 444 * stages and results are stored in fCoverageProcInfo. |
425 */ | 445 */ |
426 void calcCoverageInvariantOutput(GrColor) const; | 446 void calcCoverageInvariantOutput(GrColor) const; |
(...skipping 11 matching lines...) Expand all Loading... |
438 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 458 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
439 FragmentStageArray fColorStages; | 459 FragmentStageArray fColorStages; |
440 FragmentStageArray fCoverageStages; | 460 FragmentStageArray fCoverageStages; |
441 | 461 |
442 mutable GrProcOptInfo fColorProcInfo; | 462 mutable GrProcOptInfo fColorProcInfo; |
443 mutable GrProcOptInfo fCoverageProcInfo; | 463 mutable GrProcOptInfo fCoverageProcInfo; |
444 mutable bool fColorProcInfoValid; | 464 mutable bool fColorProcInfoValid; |
445 mutable bool fCoverageProcInfoValid; | 465 mutable bool fCoverageProcInfoValid; |
446 mutable GrColor fColorCache; | 466 mutable GrColor fColorCache; |
447 mutable GrColor fCoverageCache; | 467 mutable GrColor fCoverageCache; |
448 mutable const GrPrimitiveProcessor* fColorPrimProc; | |
449 mutable const GrPrimitiveProcessor* fCoveragePrimProc; | |
450 | 468 |
451 friend class GrPipeline; | 469 friend class GrPipeline; |
452 }; | 470 }; |
453 | 471 |
454 #endif | 472 #endif |
OLD | NEW |