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 "GrBatch.h" | 11 |
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 | |
403 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 394 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
404 this->calcColorInvariantOutput(pp); | 395 this->calcColorInvariantOutput(pp); |
405 return fColorProcInfo; | 396 return fColorProcInfo; |
406 } | 397 } |
407 | 398 |
408 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | 399 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ |
409 this->calcCoverageInvariantOutput(pp); | 400 this->calcCoverageInvariantOutput(pp); |
410 return fCoverageProcInfo; | 401 return fCoverageProcInfo; |
411 } | 402 } |
412 | 403 |
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 | |
423 /** | 404 /** |
424 * Primproc variants of the calc functions | 405 * If fColorProcInfoValid is false, function calculates the invariant output
for the color |
425 * TODO remove these when batch is everywhere | 406 * stages and results are stored in fColorProcInfo. |
426 */ | 407 */ |
427 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 408 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 */ |
428 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 414 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
429 | 415 |
430 /** | 416 /** |
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 /** | |
437 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 417 * If fColorProcInfoValid is false, function calculates the invariant output
for the color |
438 * stages and results are stored in fColorProcInfo. | 418 * stages and results are stored in fColorProcInfo. |
439 */ | 419 */ |
440 void calcColorInvariantOutput(GrColor) const; | 420 void calcColorInvariantOutput(GrColor) const; |
441 | 421 |
442 /** | 422 /** |
443 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | 423 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage |
444 * stages and results are stored in fCoverageProcInfo. | 424 * stages and results are stored in fCoverageProcInfo. |
445 */ | 425 */ |
446 void calcCoverageInvariantOutput(GrColor) const; | 426 void calcCoverageInvariantOutput(GrColor) const; |
(...skipping 11 matching lines...) Expand all Loading... |
458 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 438 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
459 FragmentStageArray fColorStages; | 439 FragmentStageArray fColorStages; |
460 FragmentStageArray fCoverageStages; | 440 FragmentStageArray fCoverageStages; |
461 | 441 |
462 mutable GrProcOptInfo fColorProcInfo; | 442 mutable GrProcOptInfo fColorProcInfo; |
463 mutable GrProcOptInfo fCoverageProcInfo; | 443 mutable GrProcOptInfo fCoverageProcInfo; |
464 mutable bool fColorProcInfoValid; | 444 mutable bool fColorProcInfoValid; |
465 mutable bool fCoverageProcInfoValid; | 445 mutable bool fCoverageProcInfoValid; |
466 mutable GrColor fColorCache; | 446 mutable GrColor fColorCache; |
467 mutable GrColor fCoverageCache; | 447 mutable GrColor fCoverageCache; |
| 448 mutable const GrPrimitiveProcessor* fColorPrimProc; |
| 449 mutable const GrPrimitiveProcessor* fCoveragePrimProc; |
468 | 450 |
469 friend class GrPipeline; | 451 friend class GrPipeline; |
470 }; | 452 }; |
471 | 453 |
472 #endif | 454 #endif |
OLD | NEW |