OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 /// @} | 400 /// @} |
401 | 401 |
402 /////////////////////////////////////////////////////////////////////////// | 402 /////////////////////////////////////////////////////////////////////////// |
403 | 403 |
404 GrDrawState& operator= (const GrDrawState& that); | 404 GrDrawState& operator= (const GrDrawState& that); |
405 | 405 |
406 private: | 406 private: |
407 bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const; | 407 bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const; |
408 | 408 |
| 409 // TODO delete when we have Batch |
409 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { | 410 const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const { |
410 this->calcColorInvariantOutput(pp); | 411 this->calcColorInvariantOutput(pp); |
411 return fColorProcInfo; | 412 return fColorProcInfo; |
412 } | 413 } |
413 | 414 |
414 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ | 415 const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const
{ |
415 this->calcCoverageInvariantOutput(pp); | 416 this->calcCoverageInvariantOutput(pp); |
416 return fCoverageProcInfo; | 417 return fCoverageProcInfo; |
417 } | 418 } |
418 | 419 |
| 420 const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const { |
| 421 this->calcColorInvariantOutput(batch); |
| 422 return fColorProcInfo; |
| 423 } |
| 424 |
| 425 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { |
| 426 this->calcCoverageInvariantOutput(batch); |
| 427 return fCoverageProcInfo; |
| 428 } |
| 429 |
419 /** | 430 /** |
420 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 431 * Primproc variants of the calc functions |
421 * stages and results are stored in fColorProcInfo. | 432 * TODO remove these when batch is everywhere |
422 */ | 433 */ |
423 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; | 434 void calcColorInvariantOutput(const GrPrimitiveProcessor*) const; |
424 | |
425 /** | |
426 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | |
427 * stages and results are stored in fCoverageProcInfo. | |
428 */ | |
429 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; | 435 void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const; |
430 | 436 |
431 /** | 437 /** |
| 438 * GrBatch provides the initial seed for these loops based off of its initia
l geometry data |
| 439 */ |
| 440 void calcColorInvariantOutput(const GrBatch*) const; |
| 441 void calcCoverageInvariantOutput(const GrBatch*) const; |
| 442 |
| 443 /** |
432 * If fColorProcInfoValid is false, function calculates the invariant output
for the color | 444 * If fColorProcInfoValid is false, function calculates the invariant output
for the color |
433 * stages and results are stored in fColorProcInfo. | 445 * stages and results are stored in fColorProcInfo. |
434 */ | 446 */ |
435 void calcColorInvariantOutput(GrColor) const; | 447 void calcColorInvariantOutput(GrColor) const; |
436 | 448 |
437 /** | 449 /** |
438 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage | 450 * If fCoverageProcInfoValid is false, function calculates the invariant out
put for the coverage |
439 * stages and results are stored in fCoverageProcInfo. | 451 * stages and results are stored in fCoverageProcInfo. |
440 */ | 452 */ |
441 void calcCoverageInvariantOutput(GrColor) const; | 453 void calcCoverageInvariantOutput(GrColor) const; |
(...skipping 13 matching lines...) Expand all Loading... |
455 SkAutoTUnref<const GrXPFactory> fXPFactory; | 467 SkAutoTUnref<const GrXPFactory> fXPFactory; |
456 FragmentStageArray fColorStages; | 468 FragmentStageArray fColorStages; |
457 FragmentStageArray fCoverageStages; | 469 FragmentStageArray fCoverageStages; |
458 | 470 |
459 mutable GrProcOptInfo fColorProcInfo; | 471 mutable GrProcOptInfo fColorProcInfo; |
460 mutable GrProcOptInfo fCoverageProcInfo; | 472 mutable GrProcOptInfo fCoverageProcInfo; |
461 mutable bool fColorProcInfoValid; | 473 mutable bool fColorProcInfoValid; |
462 mutable bool fCoverageProcInfoValid; | 474 mutable bool fCoverageProcInfoValid; |
463 mutable GrColor fColorCache; | 475 mutable GrColor fColorCache; |
464 mutable GrColor fCoverageCache; | 476 mutable GrColor fCoverageCache; |
| 477 // TODO delete when batch is everywhere |
465 mutable const GrPrimitiveProcessor* fColorPrimProc; | 478 mutable const GrPrimitiveProcessor* fColorPrimProc; |
466 mutable const GrPrimitiveProcessor* fCoveragePrimProc; | 479 mutable const GrPrimitiveProcessor* fCoveragePrimProc; |
| 480 // These oddly named parameters are used by the Calc*InvariantOutput calls t
o determine if they |
| 481 // need to recalculate optimization information. They are just pointer cach
es for the two loops |
| 482 mutable const GrBatch* fColorBatch; |
| 483 mutable const GrBatch* fCoverageBatch; |
467 | 484 |
468 friend class GrOptDrawState; | 485 friend class GrOptDrawState; |
469 }; | 486 }; |
470 | 487 |
471 #endif | 488 #endif |
OLD | NEW |